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…
EventSource and Span: take 3
Previously, we determined that mixing EventSource and Span is costly. Now it’s just a matter of finding the lowest cost. The last approach used an ArrayPool for all ETW strings. But remember that ETW events are capped at 64 KB.…
EventSource and Span: take 2
Last time, we talked about how EventSource and Span don’t really mix. ETW wants a null-terminated string for tracing and Span isn’t set up for that. It turns out this null terminator issue has been explored in some depth by…