by Oliver
8. November 2017 09:00
This is a digitalized version of my session notes from the conference.
Key Questions
- How fast is it?
- How fast could it be?
- How fast should it be?
Always measure your gains – which implies you need to measure your current performance.
Allocations Cost – Sometimes A Lot
Here's an example from Hyperion (fork of Wire):
original code – allocates a new byte array on every call
optimized code – reuses a byte array from a pool
What are the gains of this small change?
Optimizations like this one pay off especially in low-level code or inside of libraries that will be consumed by third parties. As always – first measure, then optimize.
Tools for the performance minded
- BenchmarkDotNet: a .NET benchmarking framework
- marten: async document database and/or event store
- Hyperion: a high performance polymorphic serializer for the .NET framework, built for Akka.NET
- Jil: Fast .NET JSON (De)Serializer, Built On Sigil
- protobuf-net: Protocol Buffers library for idiomatic .NET
- Microsoft Bond: cross-platform framework for cross-language de/serialization with powerful generic mechanisms (this is not your go-to tool when you just want to de/serialize some data quickly ;-) - it's a whole framework)
Have fun and stay focused!