Kindlewild

Minimizing ids

By Robin Dowling · 7 months ago

In order to minimize data size in memory and over the wire, I wanted to reduce all unnecessary bloat. Entity ids was one area that could be optimized. minimizing data size saves latency, memory and cost of data egress, which adds up over time for many clients.

I used to have a four char base62 id for entities, which is already very small. But it could be smaller, using base62 incremental ids.

The new id scheme is incrementing values in a base62 address space, starting with ”a” up to ”9”, then continues from ”aa” up to ”a9”, increasing the size of the id slowly, always ensuring the smallest possible set of unique ids.

These ids are purely internal, and the typical number of entities in an evolution is below 1 million.