This is the eleventh part of the Custom memory allocation series. For your convenience you can find other parts in the table of contents in Part 1 — Allocating object on a stack

I presented some results suggesting that UnsafeList is faster than the array or List< T> in .NET. Today it’s time to run some more serious benchmark to verify if it is so.

I am running this on Runtime=.NET Framework 4.6.1 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.7.2671.0 and BenchmarkDotNet=v0.10.14, OS=Windows 10.0.15063.1155 (1703/CreatorsUpdate/Redstone2) Intel Core i5-6300U CPU 2.40GHz (Skylake), 1 CPU, 4 logical and 2 physical cores Frequency=2437502 Hz, Resolution=410.2561 ns, Timer=TSC, as reported by BenchmarkDotNet. The benchmark code is below:

And here are the results:

The most important part is here:

I used 2 million elements for insertion and as we can see, UnsafeList is over two times faster.