Sunday, January 2, 2011

Today I learned ...(2/1/2011)

.. about base36 and Positional Notation.

Notch (ala Minecraft) uses Positional Notation to store chunks in a manner than can be easily accessed by encoding the XY coordinates in base36 representation.

I wasn't sure what the advantages of using base36 filenames over just numbers, so I researched. Stackoverflow.com had a pretty good answers:

Adam David (via Stackoverflow.com)

It's not a number because base 36 is shorter for the same ID. A 4 digit base10 number can only represent 10,000 articles while a 4 digit base36 number can represent 1,679,616 articles, and still be just as readable/printable/usable.

grokus (via Stackoverflow.com):

This scheme should produce very short IDs.
Easy to use these IDs to create on disk structure.
Easy to convert to numeric IDs to look up database, etc.

So, it looks like base36 numbers provide a more compact numeric representation (compared to base10) and encode larger numbers in this more compact representation.

Interesting.