Loops vs HashSets

When looking up data in memory from a large collection, a HashSet or Dictionary is much, much faster than looping through an ordinary collection.

This example uses strings - if you run the same code but treat them as GUIDs, the numbers improve quite a bit, but the difference between array and HashSet is still tremendous.

View code on GitHub

Comments

Popular posts from this blog

Left Join in Entity Framework

JavaScript Spread Operator

Razor Pages AJAX