Reduce download size some more? read

Reduce download size some more? read

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Reduce download size some more? read

Post by Caydr »

Hey there, just got another idea for reducing download filesize... found this program called PECompact2.

It reduces Spring.exe to 747 KB from 2.65 MB, and TASClient to 1.2 MB from 3.75 MB.

This only works for EXE files. It works by removing blank spaces and stuff like that, from what little I understand. I have tested the resulting EXEs and found them to work identically to the originals. There is no increase in startup time for any modern (1ghz+) computer.

Maybe reduce the download filesize by 1 MB or so? Try it and see.

Hope this helps!
Last edited by Caydr on 12 Aug 2006, 03:51, edited 2 times in total.
hawkki
Posts: 222
Joined: 01 Jan 2006, 19:47

Post by hawkki »

Tried it, and it actually works :) No performance loss as far as i can tell. It works by decompressing the exe when run, so in memory it is exactly the same as uncompressed so it should only slow down when launching the exe.
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

Isn't the spring package available for download already compressed? Wouldn't the compression algorithim already be taking advantage of this?
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr »

I don't know. I'm a lowly peon... but it might be worth trying.
User avatar
LOrDo
Posts: 1154
Joined: 27 Feb 2006, 00:21

Post by LOrDo »

Sounds very cool... especially since there seems to be no downsides!
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

This would affect the filesize of an install yes but not of an installer. It would be as useful as zipping up a zip archive.
IMSabbel
Posts: 747
Joined: 30 Jul 2005, 13:29

Post by IMSabbel »

Also it would result in slower loading and cascades of false positives by virus scan heuristics.
hawkki
Posts: 222
Joined: 01 Jan 2006, 19:47

Post by hawkki »

AF wrote:This would affect the filesize of an install yes but not of an installer. It would be as useful as zipping up a zip archive.
A file compressor (such as .zip ot .rar) cannot come even close to the compression factor of a exe compression program.

But when you think about the modern internet connections speed the benefit of saving perhaps one meg in the installer by compressing all exe files is not worth the extra work and marginally higher loading times.

There is a executable compressor called crinkler, used to compress 4k demos. It would be dramatically more efficient than the tool mentioned in this thread, but downside would be that it would require several minutes of decompression everytime the exe is run :)
IMSabbel
Posts: 747
Joined: 30 Jul 2005, 13:29

Post by IMSabbel »

Where did you get that idea?
Normally, compression of exe-shrinkers is worse, just because the decode-stub has to be included in the exe.
Just as a quick example: 7zip compresses spring.exe to 720 kbyte and tasclient to 1240.
Compare to first post and explain how exe compressors are that much better (hint: rar,ace,7zip and anything decent reckognizes exe files, too , if they see one)
User avatar
Acidd_UK
Posts: 963
Joined: 23 Apr 2006, 02:15

Post by Acidd_UK »

hawkki wrote:A file compressor (such as .zip ot .rar) cannot come even close to the compression factor of a exe compression program.
Curious as to why you say this...?
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Probably because indeed you can't really use the same algorithms on .exes because they have a much different structure from many other types of files. Optimizing a single compression algorithm for executables means that this algo probably gets quite bad at "normal" data and the other way round.

It is easy however to select compression algorithm on the fly (based on e.g. file extension) and to use a compressor optimized for exes on .exe files, and a generic compressor on all other files.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Still the overhead of comrpessing and decompressing so you can get rid of filesize is a bit pointless considering the compressions i only wanted for the installer size.

Any benefits in doing this rather than using the compression with the installer is negligible. Why bother trying to shave 2-3 hundred kb off of a 20-30MB installer?
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr »

Eh... because you can? A better question is, why not?
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

Because if you want to save up disk size, then optimise your maps. There you can save dozen of megs per map, hundreds and hundreds of megs if you have many maps. Saving 2 meg on the exe is ridiculously negligible next to it.

Also, compressing the exe would make Spring load slower, since it'd have to decompress the exe in memory at each launch. To the contrary, saving on map tilesets would make make them load faster.
User avatar
LOrDo
Posts: 1154
Joined: 27 Feb 2006, 00:21

Post by LOrDo »

zwzsg wrote: Also, compressing the exe would make Spring load slower, since it'd have to decompress the exe in memory at each launch.
Caydr wrote:I have tested the resulting EXEs and found them to work identically to the originals. There is no increase in startup time for any modern (1ghz+) computer.
:lol:
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

LOrDo wrote:
zwzsg wrote: Also, compressing the exe would make Spring load slower, since it'd have to decompress the exe in memory at each launch.
Caydr wrote:I have tested the resulting EXEs and found them to work identically to the originals. There is no increase in startup time for any modern (1ghz+) computer.
:lol:
zwzsg wrote:Because if you want to save up disk size, then optimise your maps. There you can save dozen of megs per map, hundreds and hundreds of megs if you have many maps. Saving 2 meg on the exe is ridiculously negligible next to it.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

I could just pretend that the loading time increase was too small for Caydr to measure, but still bigger than the saved bytes... not sure there's a scale to compare wait time and filesize however. :P
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr »

The increased initial program loading time is not noticable, even on my 1.6 ghz laptop. 1.6ghz is about the lowest anyone would want to go if they plan on running Spring, am I right? I don't think I've ever seen anyone in the lobby with a computer slower than 1.5, 1.6, 1.8... somewhere in there.

I think that if a map is a final version, has been tested to have no design flaws, why not go for broke and eliminate the ugly compression artifacts? It'll be the last time you have to download it, so why not make it memorable? AD is 25 megabytes, but you downloaded it 1 time. Certain other maps are 10 megabytes but are now up to _v5 or something by now. Anyway, this isn't about maps. I want to try to get the Spring package as tightly packed as possible, and a reduction of 1-2 mb off the installer size sounds like a step in that direction. I'm just asking that someone try it and see if there's a reduction like that when compared to an installer with uncompressed EXEs.

Already Spring is very impressively sized, in fact this is one of the things I most often see remarked upon. People say, my TA directory with all data files is 600 MB. Spring is... 30... yet is exponentially more advanced?

Whatever. It doesn't really matter, I guess. I just take it upon myself to post things like this, little ways to improve X or reduce filesize by Y with minimal or no work required. For instance, I posted about how about 700 KB worth of loading pictures weren't used in any way by any function of the game, they were even overwritten by XTA. I also have been finding more and more ways to shrink AA as well as improve compression techniques.

In the end, does 1 mb really matter? No, not really. But is the package as a whole cast in a better light by appearing to be more efficient and, to the layman, well designed? Yes.

I could've left AA at 18 megabytes, but I decided to cut out unnecessary stuff, find things that were overwritten or ignored by default, delete unused sounds, find ways to make the stuff compress better, and eventually bit by bit, it's now 10 megabytes smaller. More appealing to the end-user and less of an inconvenience to update. I think that this is one of the reasons AA is as popular as it is - it's very small and convenient. There isn't a kilobyte of bloat in the entire package now, but there is a little fat to cut from Spring still, and if you can, why not?
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

Pro
U save download == 1 new map format (maybe 2 for arguement sake) i.e around 4 mb shaved off.

Con
Slightly increased loading times
Spring releasers (/team ??) will got to double check program doesnt mess up i.e might encounter bug.


My point of view is
After u download spring u talking about been able to download 1-2 extra maps. Slightly increased loading times & releasers will have to double check the compressed version of spring == the same i.e no bugs.
IMO not worth the hassle, and very few peep gonna notice the difference.

edit:- Nice find though
HAARP
Posts: 182
Joined: 06 Apr 2006, 07:18

Post by HAARP »

If your're going to do that, at least use UPX. It's opensource, not commercial, still being developed and widely used.
Post Reply

Return to “Engine”