The producer-consumer problem is one of the greatest hits of computer science. The classic solution involves some sort of queue data structure and an event or two to notify the consumer(s). Let’s take a look at a simple implementation and…
Operation throttle: part 2
Last time, I introduced the topic of fixed operation rates and how one might implement this functionality with ad-hoc code. Today, I will generalize the concept with a simple Throttle library. As I mentioned before, we have to keep track…
Operation throttle: part 1
A while back I discussed some design points relating to fixed concurrency, such as when attempting to ensure a constant number of simultaneous active requests throughout a load test. Today I will jump back to the single-threaded world and discuss…
Microbenchmarks with BenchmarkDotNet
They say that the fastest prime number algorithm for small inputs (up to 216) is a lookup table. But this got me thinking — would it be faster to use HashSet.Contains or a List.BinarySearch? The answer to this type of…
Take it to the limit: generic type parameters
What is the highest number of generic type parameters can you have on a single type in C#? I know from experience that the answer is at least 130. (Don’t ask.) But is there an upper bound? According to Stack…