One of the many innovations in C++11 was static_assert. This allowed, at long last, a custom error message at compile time. Sure, we’ve had the #error directive for a while, but that only works for conditions that one could evaluate…
Stay COM: finishing up the tests
In the last post, we began focusing on testability with COM interface stubs. It was a lot of work, and a good reminder of why backfilling test coverage via a test-last approach is not ideal. Still, it shows that through…
Stay COM: stubs and testing
Previously, we built a Windows Task Scheduler sample application using the COM API via WIL. As far as the client code was concerned, COM was a detail encapsulated by the C++ facade we created: Not a COM pointer to be…
No time, no problem
Unit tests are supposed to be deterministic. If a test is called out as being nondeterministic, you can bet that it depends on time in some way. Any app big enough and with sufficient unit tests likely has something akin…
Let’s do DHCP: fuzzing
The DHCP server project is still alive and well. It’s definitely sample code, for demonstration purposes only, and other disclaimers. Even so, it is a technology that processes arbitrary network data, and we ought to worry about malicious input. To…
Even more performance experiments: queues and threads
Last time, we concluded that a simple producer/consumer pattern using BlockingCollection topped out at around 2200K items per second. But the profiler revealed that the Throttle itself was one major contributor to the total CPU time. Let’s first address this…
More performance experiments: queues and threads
Continuing from our previous performance experiment, I would like to see if there are any easy optimizations to apply to squeeze more throughput out of this producer/consumer queue. One possible angle of attack is to replace the implicit synchronization primitives…
Performance experiments: queues and threads
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…