or subscribe with
Join 19,000+ readers for one email each week.
Digests » 168
this week's favorite
This is part of a code that allow users to subscribe to changes in the database using a WebSocket. This is pretty rare, so we check that there aren’t any and skip all the work. We had a bunch of code that run on many threads and ended up calling this method. Since there are not subscribers, this should be very cheap, but it wasn’t. The problem was that the call to Count was locking, and that created a convoy that killed our performance.
.NET Core 2.0 is available today as a final release. You can start developing with it at the command line, in your favorite text editor, in Visual Studio 2017 15.3, Visual Studio Code or Visual Studio for Mac. It is ready for production workloads, on your own hardware or your favorite cloud, like Microsoft Azure.
There is a simple pattern that is extremely effective and increases source code readability greatly. Sadly this pattern is underused and many developers do not even think about it. I am talking of course the ThrowIf methods used to throw exceptions when validating state and arguments.
Over the past few weeks I've been submitting improvements to some of the C# programs in the Benchmarks Game.