Endjin - Home

Performance

We worked on a project recently which required us to build a highly performant system for processing vast quantities of messages in real time. We had made the decision to run this processing using Azure Functions with C#. This post runs through some of the techniques we used for writing highly performant, low allocation code, including data streaming, list preallocation and the relatively new C# feature: Span.


The inimitable Ian Griffiths left a great comment on my last post – saying that: You seem to be implying that the LINQ query was being evaluated each time round in “the outer foreach”. But I don’t think that’s right. A foreach loop evaluates its collection expression just once at the start of the loop. […]


A Short Tale of a Deceptively Slow LINQ Expression

by Howard van Rooijen

With any good iterative development process – the first step is to get something working: solve the problem in as simple a fashion as possible, then refactor. Part of the refactoring consideration should be an initial performance monitoring spike to see which parts of your codebase are running slow. Once I had the initial prototype […]