Buy Me a Coffee

Buy Me a Coffee!

Wednesday, December 4, 2019

Benchmarking on More Platforms

In the previous article I looked at the performance of different mathematical operations and found that the Decimal operations of C# take around 10 times the time it takes for same Double.  I also found that the performance profiles of different processors vary greatly.  So, I decided to take a look at several different processors and see what other interesting things I could find.

To start with, I ran the code on my Intel Compute Stick to see how the Atom processor performed.  It actually put in a solid and relatively flat performance similar to the Core i7 we looked at last time.  Here are the addition results:
And the results for multiplication operations were:

Note that multiplication beats addition yet again.  I believe I know why, but will save the explanation for later when I dig even deeper into the underlying code that is being generated.  As a hint, take a look at the multiplication tests, I believe it is an artifact of the test rather than an actual instruction speed difference.

To get another architecture I am going to run out and buy a new computer I need to get a bit creative.  I am an Azure head, so looking at the processors available on the Virtual Machines I noticed that the Lsv2-Series run on the AMD EPYC™ 7551 processor which would be interesting.  So, I will create an L8s-v2 in the East US 2 region.  I ssh'd in and used the information from my Installing .NET Core article to install .NET Core and sftp'd in the code.  I ran the test, downloaded the results and deleted the VM (a $464.26 a month burn rate is more than I want to mess around with).  The results were...interesting.  The addition results were:

And the multiplication results were:

The multiplication results were right in line with the addition results, and the decimal was actually longer!  That is the first time the results came out like that, so we need to dig in to figure out what is going on.

Monday, December 2, 2019

All Benchmarks Lie - Or Why Benchmarking Matters

I just finished taking a C# class given by a peer at Magenic who just happens to be a Microsoft MVP for C#. :-)  I love working with smart people!  I has been at least 3-4 years since I spent any time actively learning about C#.  I have picked up other topics (like Pivotal Cloud Foundry) and languages (like Flutter) but I haven't worked on the main tool I use every day for work.  For Shame!  Ralph and I spent a bit over a year doing a Code Dojo with other developers, but that was back in 2013.

As part of the course, the question came up about why anyone would use Double when Decimal has better precision.  We talked through it in class, but I thought it would be illustrative to actually run a benchmark on sample code and show the differences.  So, I ran up a quick benchmark test and proved that addition and multiplication of Decimals are around 10 times more costly than equivalent Double operations.  My laptop results for addition were:

The results for multiplication were:

It was strange for me to see that multiplication was faster than addition, but the magnitudes were not surprising.

As the capstone for the course we had to do a project using C#, so I decided to expand on the idea of benchmarking the different operations by running the tests on different architectures.  Another peer is writing a series of blog posts on running Kubernetes on a Raspberry Pi cluster and I happened to have a Pi 3 A+ that I am using for another project so it was an obvious first choice.  The results were similar, but somewhat less consistent.  The decimal operations cost about 10 times that of the others, but the  byte multiplication operations are almost twice as fast as the long integer multiplication operations.  There were also a greater difference between the multiplication operations and the addition operations.  Here are the addition results:

And here are the results for multiplication:

I have an older Dell PowerEdge R710 that I picked up from TechMikeNY last year to play with some Cloud Foundry stuff so I decided to see what the Xeon processors looked like running the same code.  This is more like what would be expected to be seen in a production environment.  The addition results look like:

And the multiplication results were:

Wow!  Those results looked significantly different than the previous ones.  For one thing, these are the first results that I had seen with the MultiModalDistribution warnings, so I ran them again to make sure the results were consistent.  The results were similar, but not the same.  They were more similar to each other than to the other architectures.  Here are the results for the addition tests:
And here are the results for the multiplication tests:

I went on to do tests on a couple of different Azure VMs, but I am going to save that is for a different article. :-)  I also have plans to dig into these differences a little more and see if I can't track down the underlying causes for the displayed differences.

Saturday, November 30, 2019

Installing .NET Core (quick hit)

I am working on a series of articles and need to install .NET Core 3.0 on various Linux platforms.  This is just a quick article so that I can find these links later:

  1. Centos, Redhat, Fedora, Debian, Ubuntu, SUSE, or OpenSUSE:
  2. Raspbian:
  3. And finally, I need to get Mono installed in the same as well as Windows:

Friday, November 29, 2019

Another look at benchmarks

A little over two and a half years ago, I have a blog post investigating the difference in the memory footprint between the use of StringBuilder and general string concatenation.  The version of BenchmarkDotNet that I used was v0.10.2 and I used Framework 4.6.  Now is a good time to retry using the latest in both, v0.12.0 and .NET Core 3.0.  So, let's start a new project based on Console App (.NET Core) and name it as before:
New project with Console App (.NET Core) selected

Then let's add the BenchmarkDotNet NuGet package:
BenchmarkDotNet in NuGet

And accept the changes:

Add the source from the previous article and give it a run by changing into your directory and run via dotnet StringsVSStringBuilder in an administrative command prompt:

When it runs, you will notice that the first thing that it does is compile the benchmark.  That is different than what the previous version did, but it isn't really surprising.  It makes sense to compile the application into a known state, and the tooling has come a long way.

Looking at the results, we find that we need to do a bit more to get the memory output that we are looking for in this instance:

The MemoryDiagnoser is no longer enabled by default:

Let's add it via an attribute on the test class:

Now, running the tests again and we get the memory output again:

As before, the concat method allocated a little more than twice the memory of that of the StringBuilder version.  It is also a small, but significant bit faster.

Sunday, June 30, 2019

Super Sunday Tech Roundup #5

On the road this week for PI Planning for my current client and walking around in the Mall Of America I had a chance to visit the Lego Store and the MindStorms EV3 looks pretty amazing!  The software is as impressive as the hardware, making it easy to transition between complexity levels as a child grows in understanding.
MindStorms EV3
I also am getting ready to put Schroeder on a plane for Texas and loaded his Kindle PaperWhite with books using Calibre.  Whenever I need to use it I remember what an awesome piece of software it is.  It just works, and does an amazing job.

Calibre ebook management

Sunday, June 23, 2019

Super Sunday Tech Roundup #4

I am getting more and more into Kubernetes, and want to do some cluster work on my desk with multiple machines and Dell 710 servers are just too heavy to carry around.  So, I started looking into smaller machines and thought about Raspberry Pi’s and how to work with a stack of them and found the PicoCluster site and fell in love.  I know what I want for my next birthday!

Less is More

As part of my rabbit hole search above, I was talking with a colleague and he said ‘I have these 2 Android phones, could you use them?’ And after some searching, I found the answer was no but we can do some cool stuff on it.

How to Turn an Android Device Into a Web Server

Sunday, June 16, 2019

Super Sunday Tech Roundup #3

I am not a Git Guru, but I found Write yourself a Git and interesting article.  I am inspired to build out a similar tutorial in C# but  I doubt I will take the time.  Too many other things drawing my attention and limited time.
Write yourself a Git
Last year I got one of the Intel Compute Sticks to play around with.  My initial goal was to use it to front playing games or to do a media player at home.  But it just hung from the back of a monitor at work for 6 months gathering dust.  But now!  I am going to install Fedora Linux on it and make it my Kubernetes Master for a portable cluster.  I should get an article or two out of that.
Intel Compute Stick

Sunday, June 9, 2019

Super Sunday Tech Roundup #2

I am getting back into Linux as part of installing Kubernetes and found the Cockpit project.  It makes Linux accessible through a web interface.  This lets me work with my play systems without having to ssh in.  For my Fedora installation, I installed a specialty dashboard to control my Kubernetes cluster by issuing dnf -y install cockpit-kubernetes

Cockpit makes GNU/Linux discoverable. See your server in a web browser and perform system tasks with a mouse. It’s easy to start containers, administer storage, configure networks, and inspect logs.

I am not a Java devote, but it is great for all that Pivotal has decided to back OpenJDK.  Sharing is caring, and open wins hearts and minds.
Pivotal Throws Its Weight Behind Open JDK with Spring Runtime

Sunday, June 2, 2019

Cloud Foundry and DotNet

The talk that Nathan and I did at Cloud Foundry went well.  Here is a video of it: Deep Dive: .NET & CF Pipeline.  Enjoy!

Super Sunday Tech Roundup #1

I work with clients all the time, and never have enough space for a set of keyboards and mice for all of the machines I work with. I have tried different KVM switches and other hardware and software solutions to share keyboard and mouse with the various machines, but all have fallen short. Until now. I missed the launch, but a colleague mentioned it and I finally have a solution that just works. If you have similar needs for connecting a single keyboard and mouse to multiple Windows computers, I cannot recommend this highly enough:
Mouse Without Borders
My wife gave me a Herman Miller Aeron chair for our 5th anniversary, and I have loved it and used it daily for 14 years now. I worked from home for most of those 14 years, so the chair got heavy use. It is still going strong. Last year, I took my chair into work since I am now working more there than at home. The move to New York had us in a tiny place that didn't have room for a home office.  After our 18 month lease ended, we moved to where we are now, a place with office space for me again.  I took advantage of the fact that there is a Herman Miller show room to take a peek at some furnishings.  I love the Aeron, but my new Embody is a winner.

Embody by Herman Miller

Headphones are a personal thing, I get that.  I have been wagging my Logitech H800s back and forth from the office for over a year now, but getting a home office set up forced me to re-visit my solution.  The H800s fold up and pack away easily.  I really like the size and weight of the H800s, but I really don't like the base foam ear pads.  They cheapen an otherwise solid product.  I first tried some Microsoft LifeChat LX-3000s for home, but a microphone error and issue with not being able to un-mute Skype calls left me frustrated. I ended up going with a wired Logitech H540 and have been very happy.  Here at home, I don't really need portability or wireless, so it works out well.  Plus, they have the leatherette ear pads.
Logitech H540 USB Computer Headset

That is all for this week, see you next Sunday!

Saturday, April 6, 2019

Hard Core

I love reading about someone going deep into a technological rabbit hole just because. The Adventures of putting 16 GB of RAM in a motherboard that doesn’t support it article is exactly what I needed to get motivated to dig back into the gnarly bits of the binary file produced by the .Net compiler. Digging deeper is the only way to go.

Monday, April 1, 2019

Cloud Foundry and DotNet

Nathan Allen-Wagner and I will be speaking at the Cloud Foundry North American Summit this week about how to merge the modern Dot Net pipeline with the Cloud Foundry one. We are going to touch lightly on the culture shifts and dig into the tooling shift. If you are in Philadelphia on 4/4/2019, come on by!

Sunday, February 24, 2019

Great videos from the past

I just found that someone posted (with permission) a set of SysInternal videos from 2006 on YouTube. It has been a lot of fun watching them and remembering what it was like, back in the day. Enjoy!

Saturday, February 23, 2019

Brave - BAT

I have been playing with different cryptocurrencies for a little while, just dabbling. I wasn't in early enough to be a 'BitCoin Millionaire' or anything. Nothing serious, no ream money to be made or lost. I really like Ethereum and have mined a bit. Again, nothing serious. I don't have a dedicated mining rig or anything. The thing that kept me from really digging into the technology was that I was not sure what real problem they were solving. Or perhaps it was just that the problem they were solving wasn't a problem I had. Cash is locally anonymous and I don't feel the need to be anonymous over distances. Then a colleague turned me onto BAT (basic attention token), and I saw something that was solving a problem I had. Or, it was solving a nuisance that I hadn't felt like solving. I regularly use Chrome, but I don't have an add blocker. I want to 'pay my share' for the free content I am viewing but there are sites I avoid because of the pervasive adds. Now there is the Brave browser that allows you to pay for content while also blocking adds and trackers. So, I decided to give it a try. I also signed my blog up to receive tips and tokens. Both of you reading this can now pay me for my awesome content! :-) I will be back to creating content and will keep you updated on this. I am off now to add a tip jar to Ralph and my Cloud Talk Show.