Dictionary Keys

 

Swift High Performance: Dictionary Keys


This article is an in-depth exploration of how to create dictionary keys that are fast and performant under all circumstances, and why String-based keys often fail in that regard.

It includes actual examples and performance data taken from Factory, my open-source dependency injection library.

Ready? Let’s get into it.

Caching

A common practice in any application is to create some expensive item, cache that item in a key-based dictionary, and then check later on to see if that item exists, returning the cached value if it does.

An extremely rudimentary implementation of that might be:

Visit





Previous Post Next Post