Usually, a failing test is a problem. In this article I will cover three cases where this might not always be true: performance tests, testing a data science model such as a classifier, and testing in quantum computing. In all these cases, a definitive answer about passing or failing is given by a set of … Continue reading When a failing test might be OK
Category: Performance
Recursion and iteration – loop unrolling
This article is part of a series on recursion and iteration: Introduction to iterationIntroduction to recursionMutual recursion and tail recursionBlurring the linesLoop unrolling In this article I will talk about loop unrolling, and the wonder / horror that is Duff's device. Image credit Loop unrolling Loop unrolling is something to do only when you're very … Continue reading Recursion and iteration – loop unrolling
Recursion and iteration – an introduction to iteration
This is the first of a series of articles about recursion and iteration Introduction to iterationIntroduction to recursionMutual recursion and tail recursionBlurring the linesLoop unrolling Recursion and iteration are both techniques for doing some work (or similar work) repeatedly, so that you can solve a bigger problem. This could be things like summing all the … Continue reading Recursion and iteration – an introduction to iteration
P = NP?
This article is my attempt to put my money where my mouth is. A friend mentioned the BBC Radio 4 series In Our Time on Facebook, and in the conversation that followed I said that the only time In Our Time discussed something close to my home turf I got grumpy about how poorly I … Continue reading P = NP?
Complexity: Performance trends in code
Introduction If you hang around programmers for long enough, you might hear people use terms like complexity or Big O notation, or say that performance is of the order … such as of the order N squared. I hope that this article makes those terms a bit less confusing. The basic idea is seeing how … Continue reading Complexity: Performance trends in code
Performance optimisation – for machines or people?
I recently watched a video and listened to a podcast that form an interesting pair of opinions about performance. The video is Patterns for high-performance C# and the podcast is SE-Radio Episode 357: Adam Barr on Software Quality. There are two things where the podcast and video have no differences: the system must behave correctly, … Continue reading Performance optimisation – for machines or people?
Lazy initialisation and threads (in C#)
Lazy initialisation is a way to set up everything needed to initialise something, but put off the initialising until later, usually when the value of the thing-being-initialised is needed for the first time. You might want to use lazy initialisation because something is expensive to initialise, and you might not need it. Or because you … Continue reading Lazy initialisation and threads (in C#)
S.E. Radio podcast on latency
I'm still slowly working my way through the back catalogue of the Software Engineering Radio podcast. One episode that I particularly liked is 277: Gil Tene on Tail Latency. It has interesting and useful stuff that helps you see things clearly. For instance: How there's more than one measure of latency (mean, median, 90th centile, … Continue reading S.E. Radio podcast on latency
Streaming and buffering in C# and Talend
This could also be entitled: How to make your code over 3x faster*. I love LINQ in C#, and I think that I'm not the only C# programmer who does. However, there are hidden problems to watch out for, and I'll describe one now. It is based on the difference between streaming and buffering, which … Continue reading Streaming and buffering in C# and Talend
How to make your code 500x faster*
(*Sorry, the techniques I describe don't apply in all circumstances.) This graph shows the time taken by 8 different ways of doing exactly the same thing: retrieving the details of 20,000 orders from a database. The taller the bar, the more time it took. Unfortunately I had to use a log scale because the range … Continue reading How to make your code 500x faster*