Repository navigation
Replies: 2 comments
|
Makes sense. I'd love to see a prototype on the data builder at least. We can work on the lookup separately. It will likely use some bitmasking techniques. |
|
I finally got around experimenting with this in https://github.com/jnyrup/GeoTimeZone/tree/dense_packing using the simple tricks. baseline
Remove line endings
Compress line numbers
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I have some ideas for increased packing of the data, but before implementing and experimenting, I'd like to sketch the idea first to hear if this has any interest.
Currently the data is stored as text, with:
With ASCII encoding of the characters, that 72 bits per line and 11,336 KB in total.
My first thought was, why storing all those newlines, when both the hash and the line number are fixed sized?
Removing that brings us down to 64 bits per line, which is an 11% reduction, or -1256 KB uncompressed and ~89 KB compressed in absolute numbers.
Next-up, we're storing the data in text, which seems to favor human readability when debugging, but the data is ~100% of the time machine-read.$\lceil log_2(420)\rceil = 9$ bits, which still leaves room for 92 new zones.
E.g. we use three ASCII digits (24 bits) to refer to one of the 420 different zones.
If we instead stored the data in some binary format, we wouldn't need more than
The hash alphabet
0123456789bcdefghjkmnpqrstuvwxyzis 32 characters, so in theory we only need 5 bits to cover them all.For hashes of length five, this would reduce from 5*8=40 to 5*5=25 bits,
In total we could get down to 34 bits per line which is a 52% reduction.
Some unknowns that require implementation and experimentation:
All reactions