lgommans / factorio-serverlist

Unofficial server browser for Factorio
https://lgms.nl/p/factorio-serverlist
MIT License
6 stars 5 forks source link

Compress server data #3

Closed lgommans closed 8 years ago

lgommans commented 8 years ago

The data gets over half a megabyte during busy hours and is still a couple hundred kilobytes during slow hours. Some testing should be done with compression. Ideally, the decompressor should be small and very fast:

I'm thinking of some simple string replacements, possibly making it a binary format, but my thoughts still focus on a substitution scheme for JSON. It's probably better to do some testing with existing algorithms like deflate, though I wonder how fast bitwise operations are going to be in Javascript (namely Huffman).

Compression time is not an issue, within bounds of course.

lgommans commented 8 years ago

I had a go at this... and then discovered my server already gzips the data. My custom lz77 implementation was completely redundant, and while it was fine in Javascript, in PHP it was way too slow.

Additionally I have removed some unused fields (mod_crc and game_secret) from the data, making it smaller still.

The download size is currently under 100KB and I doubt it's going to get much better without a disproportional amount of work, so I am closing the issue.