.NET Developer Days 2017: Performance That Pays Off – by Szymon Kulec @Scooletz

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

bitcon

optimized code – reuses a byte array from a pool

bitcon-no-alloc

What are the gains of this small change?

perf-table

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!

Pingbacks and trackbacks (1)+

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

About Oliver

shades-of-orange.com code blog logo I build web applications using ASP.NET and have a passion for javascript. Enjoy MVC and Orchard CMS, and I do TDD whenever I can. I like clean code. Love to spend time with my wife and our three children. My profile on Stack Exchange, a network of free, community-driven Q&A sites

About Anton

shades-of-orange.com code blog logo I'm a software developer at teamaton. I code in C# and work with MVC, Orchard, SpecFlow, Coypu and NHibernate. I enjoy beach volleyball, board games and Coke.