Anyone who has dealt with both “narrow” and “wide” strings in the same C++ module is inevitably faced with this little annoyance: In MSVC, you might see an error like C2676 (“binary ‘<<‘: ‘std::basic_ostream<char,std::char_traits<char>>’ does not define this operator or…
Digits: faster in practice?
While everyone loves theoretical performance improvements, we need to check back in with reality from time to time. To review, we had proposed a near-zero allocation strategy to help improve the speed of a Digits game solver. After all, heap…
Digits: faster in theory
Previously, we gave a send-off to the New York Times “Digits” game with a custom solver app. Unfortunately, the solver took quite some time (several hundred milliseconds) and even more space (several hundred megabytes) to analyze the solutions for one…
Goodbye Digits
As of August 8, the New York Times game Digits is no more. Digits was a game where you were given a target number and six smaller numbers. Combining the smaller numbers with the four basic arithmetic operators, you would…
Switch expression performance: part 2
Previously we looked at the performance of simple switch statements and expressions. Today we will consider switch expressions with when clauses. This example shows a simple letter grade calculator as might be defined for a US high school: The first…
Switch expression performance: part 1
Being the good multi-paradigm language that it is, C# has adopted features from across the programming spectrum. One recent addition of the functional programming variety is pattern matching, first arriving in C# 7.0 with enhancements in C# 8.0. The latter…
Null operator performance
The null-conditional (AKA “Elvis”) operator and null-coalescing operators were introduced in C# 6.0 and C# 2.0 respectively. They’ve been with us for years and help make our code more concise. But have you ever wondered about their effect on performance,…
Low-latency latency measurement
Measuring latency is easy with .NET. Just use a Stopwatch! This is certainly the most commonly recommended way to measure operational timings. But is it the fastest way? It seems almost absurd to ask for a low-latency latency measurement, but…
Let’s do DHCP: diagnostic events
There is always something new to do with the DHCP server sample. Today we will look at how to add diagnostic events. After all, any good server technology intended to run in real world production scenarios needs observability. One approach…
A faster TryFormat
As part of my ongoing DHCP adventure, I needed to start thinking about string formatting for some of the core data types like MacAddress. After all, these values are likely to make their way into a trace file eventually and…