.NET
Are You Using the Stopwatch Efficiently in .NET 7? (via Nick Chapsas)
- The old way of doing things allocated a Stopwatch instance on the heap (i.e., used memory).
- You can do some fancy stuff with structs to use the stack instead, or…
- .NET 7 added a Stopwatch.GetElapsedTime(startTime) method, which pairs nicely with the Stopwatch.GetTimestamp() method. It’s slightly faster and allocates no memory.
- The takeaway is that this new method saves memory and time the more Stopwatch instances you have running around.
What are frozen collections coming in .NET? (via Nick Chapsas)
- We currently have things like List<T>, Dictionary<T>, and HashSet<T> with their immutable counterparts — ImmutableList<T>, etc. Those immutable collections still have Add and Remove methods; they just return a new collection.
- .NET 8 has frozen collections — e.g., FrozenList<T>, FrozenSet<T> that do not have Add and Remove methods.
- Nick also goes over the performance of initialization and use of the collection, immutable collection, and frozen collections using Benchmark.net.
Leadership
How Leaders Should Handle Public Criticism (via HBR)
- Accept that it’s part of the job
- Don’t use fairness as a gauge to respond
- Set the record straight with facts, not emotion
- Humility and transparency are your friends
- Filter conflicting advice through your values
- Resist becoming cold and hardened
- Look for the kernels of truth
- Take action and report back