3 ms·
> If you sort the numbers, then represent them as the amount you need to add to the prior number[1], it produces a very small file once compressed...about 4k[2]
by gruez 5y ago
> If you sort the numbers, then represent them as the amount you need to add to the prior number[1], it produces a very small file once compressed...about 4k[2].
That seems like a nightmare to do searches on. I'd probably compress it with a prefix tree or similar. In terms of off the shelf solutions, sorting the list, saving as a newline delimited text file, and then compressing with LZMA2 gets you down to 22KB.
- baobabKoodaa 5y agoYou don't need to do searches on the compressed JSON, you can uncompress it in memory in client-side to do searches.
- pradn 5y agoIt's easy to do searches on 74,000 numbers. Unpack them into an array and do binary search. No need for prefix trees when binary search will do just fine. Much simpler, too. The unpacking process is trivial if the list is packed using the method described above, where diffs are stored, not whole numbers.