Page 1 of 1

Zipped but not compressed

PostPosted: 30 Sep 2010, 17:28
by mtgrares
I just got done reading an article that suggested that some IO can be improved if you use an uncompressed zip file. It said that the official Java jar files are zipped but not compressed. I'm just throwing this out there as an idea that may improve Forge's startup time or for the individual card files.

Re: Zipped but not compressed

PostPosted: 30 Sep 2010, 17:43
by Rob Cashwalker
As the card files go, I think with the card-per-file format, we've had huge leaps in the number of cards added, because it's easier to manage without conflicts.

Re: Zipped but not compressed

PostPosted: 30 Sep 2010, 18:31
by gestalt
I think there is a way to do both.

You can create a cache with parsed objects. I know it is extra work but it can work nicely. When loading files, the program can first check whether the compiled version exists or not. If it exists loads the serialized version if not loads the individual card files and creates a serialized version. So next time it is run the load time is shorter. For additional convenience, you can create a checksum of the cards.txt files and store this checksum in the serialized version (using cardnames, modification times and file sizes for instance). This way the changes can be detected as well.

In the end early optimization is the root of all evil. So maybe a better approach is to first measure the impact of loading card files to the overall startup time.

Just my two cents...

Re: Zipped but not compressed

PostPosted: 01 Oct 2010, 16:49
by mtgrares
I like the saying "Early optimization is the square root of all evil". I tell myself this many times because optmization hacks are just that, hacks, which are generally evil (ie. bad programming practices).