Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upLosslessly compress all tiles #21685
Conversation
This comment has been minimized.
This comment has been minimized.
|
What does it do to load speed?
|
This comment has been minimized.
This comment has been minimized.
"However, remember that decompression is still the same speed, and totally safe" (see https://blog.codinghorror.com/zopfli-optimization-literally-free-bandwidth/ and https://developers.googleblog.com/2013/02/compress-data-more-densely-with-zopfli.html). Also https://superuser.com/questions/741011/do-more-compressed-png-images-take-longer-to-load. |
This comment has been minimized.
This comment has been minimized.
|
Decompression speeds should be similar, - perhaps marginally increased (we're talking nanoseconds most likely) and the net result should be faster load speeds as file size is much more important in image loading than compression scheme. This is for mobile apps, and thus different hardware, but the principle is the same:
https://imageoptim.com/tweetbot.html And another one: https://www.cocoanetics.com/2011/10/avoiding-image-decompression-sickness/ |
This comment has been minimized.
This comment has been minimized.
|
The answer you're looking for is "I don't know", the articles pointing out
that it helps sometimes are irrelevant.
I'll see when I can test it, but no idea when I can get around to it.
|
This comment has been minimized.
This comment has been minimized.
|
Hah – thought those articles were fairly conclusive. Will work on finding more assertive ones. |
This comment has been minimized.
This comment has been minimized.
|
I'm convinced that it's faster in theory, so more articles won't help. I just want a simple test that demonstrates that it doesn't actually regress. I need to double-check when tile loading happens, but it might be sufficient to simply do something like: |
This comment has been minimized.
This comment has been minimized.
|
I like the change, but it will tend to regress since the tilesets are occasionally updated. |
This comment has been minimized.
This comment has been minimized.
|
@codemime correct – was almost tempted to not compress the Chesthole tilesets. The other tilesets are very rarely updated. However, my thinking is that a future regression from an update will have minimal impact and I'm more than happy to compress again at certain points in the future. Also @kevingranade I've been looking into this a lot more and my thinking was erroneous – there will be no additional "decompression" time. To the computer, these files are rendered exactly the same as the original files, they just happen to be smaller. PNGs themselves are compressed files, and the performance of decompressing them into raw pixels is only relative to the filesize. Which is to say, the speed of rendering them to the screen will only increase as filesize goes down. The algorithm used to get to that smaller filesize is irrelevant. |
This comment has been minimized.
This comment has been minimized.
|
It should probably be automated. |
This comment has been minimized.
This comment has been minimized.
|
@Coolthulhu I will say that my initial goal in this was to free up room in the repo for adding in the music created in the original CDDA contest. As I understand, it was removed due to space constraints on the CI server. |
This comment has been minimized.
This comment has been minimized.
|
@Leland I think a better way to handle the space constraints is to make the data files available outside the existing build path. Also the music files are just gigantic all on their own :/ |
This comment has been minimized.
This comment has been minimized.
|
Made #21690 for tracking tile compression automation; this PR should be a net positive for the time being, and ready to merge – assuming @kevingranade's good with my breakdown of compression logic above. |
This comment has been minimized.
This comment has been minimized.
|
hahahahaha!!!!.... whew
|
This comment has been minimized.
This comment has been minimized.
|
BTW, here's my benchmark code:
|
This comment has been minimized.
This comment has been minimized.
|
Android players are gonna LOVE you. |
kevingranade
merged commit ff0fc1b
into
CleverRaven:master
Aug 23, 2017
This comment has been minimized.
This comment has been minimized.
|
Side note, I don't trust these numbers to be at all accurate, they're jittery as hell, but it's a massive improvement so measuring more carefully is pointless. |
Leland commentedAug 20, 2017
•
edited
Reduces file sizes by >30% on average, reducing total file size by 6.5mb.
Pngcrush, Zopfli, PNGOUT and Advpng were used to compress.