Skip to content

Instantly share code, notes, and snippets.

@apocalyptech
Created June 23, 2021 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apocalyptech/986425cf89d18707c498cd7e1d001f2e to your computer and use it in GitHub Desktop.
Save apocalyptech/986425cf89d18707c498cd7e1d001f2e to your computer and use it in GitHub Desktop.
pre-compression:
{"v":1,"p":[[0,1,2,3,4,5],[6,7,8,9,10,11,12,13,14,15],[16,17,18,19,20,21],[22,23,24,25,26,27],[28]],"l":[[3,2,1,0],[0,1],[0,1,1],[0,2],[0,1,2],[0,1,1,2],[0,2,2],[0,3],[0,1,3],[0,1,2,3],[4]],"s":[[10,9,8,7,6,5],[4,0.4,0.4,3,2.25,1.625],[6,0.6,0.6,5,2.875,1.9375],[8,0.8,0.8,7.5,3.5,2.25],[15,1,1,10,4.125,2.5625],[30,1.2,1.2,13,4.75,2.875],[45,1.4,1.4,16,5.375,3.1875],[60,1.6,1.6,19,6,3.5],[80,1.8,1.8,22,6.625,3.8125],[100,2,2,25,7.25,4.125],[100,1,1,12.5,7.25,4.125]]}
(470 chars)
"v" should be fine in 8 bits
"p" values can fit into 5 bits (max. is 29), would need an additional 5-bit length field
"l" values could fit into 4 bits, would need an additional 4-bit length field
"s" values would have to be 32-bit floats, alas. no length fields needed; just 11*6
>>> (8+(5*5)+(6*5)+(10*5)+(6*5)+(6*5)+5+(11*4)+(4*4)+(2*4)+(3*4)+(2*4)+(3*4)+(4*4)+(3*4)+(2*4)+(3*4)+(4*4)+4+(11*6*32))/8
307.25
(8+
(5*5)+
(6*5)+(10*5)+(6*5)+(6*5)+5+
(11*4)+
(4*4)+(2*4)+(3*4)+(2*4)+(3*4)+(4*4)+(3*4)+(2*4)+(3*4)+(4*4)+4+
(11*6*32)
)/8
So 308 bytes, or 65% of the original. And presumably that wouldn't compress as well, either.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment