Blazingly Fast Abstractions using Generics
Earlier this year, I had an interesting conversation with another ProgSoc member about the performance benefits of generics compared to abstract interfaces. So I thought I might as well make my first blog post here about that!
This post mainly applies to compiled languages such as C#, C++, Rust, and possibly Java, however Java appears to use dynamic dispatch significantly more than necessary.
I will be using C# for demonstration, and I'll try to keep it simple and relevant to other languages also.