Click here to Skip to main content
Click here to Skip to main content

Aggressive Optimizations for Visual C++

By , 26 Oct 2002
 
  • Download header file - 1 Kb
  • Contents:

    Article:

    Shortly after VC6 came out, I was rebuilding a program into separate DLL modules, and noticed that the sum of the sizes of these release built DLLs were a lot higher than I expected - almost an additional two megabytes larger than the original single EXE. So I went back and checked the output size of the EXE from what Visual C++ 5.0 was producing versions what 6.0 was producing - the 6.0 version was much larger, even with all the project optimizations turned on.

    As it turns out, both VC5 and VC6 default to a code generation method that does not produce the smallest code possible, even when you have that option turned on in the project settings. In addition, VC6 and VC7 use a different padding value that VC5 - 4k vs. 512 bytes. This causes each section (.data, etc) to be rounded up to the next 4k boundary, which causes excessive file bloat.

    The reason for the 4k rounding in VC6 seems to be because of the Win98 file tuning tool - it likes programs that are on the 4k boundary, since they fit nicely in the x86 virtual memory page. More on why this is not a stellar idea later.

    Rather than messing around with a bunch of project settings, I've provided a nice and simple header file that you can include in your Stdafx.h (or anywhere - this is not MFC-only stuff). It works for both VC5 and VC6, it works marginally for VC7 (.NET), and may work for VC4 - haven't tried it there. It only kicks in during Release builds, so it's safe to leave in for debug builds, too.

    The header tells the compiler to use certain optimization settings that removes frame pointers in the source code, which saves space and time. It then has the linker merge the .data (your text strings, constants, tables, etc), .text (where you code is), the .rdata (re-only data - consts and etc - see note), and the .reloc (relocation data) into a single unit . This cuts down on space taken by the rounding-up of these areas, and is especially noticeable with small dlls and CPL programs. The final twist is to tell VC6 to behave like VC5 and use 512 byte padding instead of 4k, which further shrinks the output. The header file is pretty well commented, and can be dropped into almost any program. I've used this in both small and large applications, and it definitely helps with the output. For example, I got a 93k exe down to 52k with this, and a control panel applet down to 4k from 33k (see RRLoginV3 for an example of this savings). Larger programs do not seem (from a filesize standpoint) to benefit, since the space saved is smaller compared to the larger file (40k from a 1600k exe doesn't impress many people). Loading times are faster, however.

    When using this header, please be sure to fully test your release builds before shipping them. Heck, test them without the header too just to prove that it's not causing the problem (which I doubt that it is - four years, fifteen major projects I used it with, at least 21,000 other people using it - no problems). Some code that works fine under Debug will break under Release - this is due to Microsoft's optimizations, and is a know problem with all optimizers on all platforms, and coding in general - amazing how many time we don't check for null pointers or bad data before we use something. Debug will zero things out for us, set them to know values (0xCC etc), where as Release it's random. Generally, if you are getting continual GPF's when using this header, either stop using or else track down the line in your code that is causing it.

    There are some tradeoffs, of course. Linking is slower due to the merging of the data segments into one, and in general, compressing the file will not be any better than before (this is because the empty space is removed before compression, where as before, it was hidden by compression). For me, these are reasonable tradeoffs, since I do not make release builds every day, and any space saved in the exe generally means a smaller download for my users, and definitely less memory and space used on the user's system!

    Notes:

    Merging the .rdata with static MFC will almost always result in a larger EXE. This also seems to affect things when you are mixing static libs (either 3rd-party or your own in-house stuff) with MFC, linking it static or not. If you really want to merge the .rdata section with the rest, define _MERGE_RDATA_ in your project or before including AggressiveOptimize.h header.

    Why Not

    The argument can be made that doing this is a waste of time, since the "zero bytes" will be compressed out in a zip file or install archive. Not really - it doesn't matter if the data is a string of zeroes or ones or 85858585 - it will still take room (20 bytes in a zip file, 29 bytes if only *4* of them 4k bytes are not the same) and time to compress that data and decompress it. Also, 20k of zeros is NOT 20k on disk - it's the size of the cluster slop- for Fat32 systems, 20k can be 32k, NTFS could make it 24k if you're just 1 byte over (round up). Most end users do not have the dual P4 Xeon systems with two gigs of RDram and a Raid 0+1 of Western Digital 120meg Special Editions that all worthy developers have (all six of us), so they will need any space and LOADING TIME savings they will need; taking an extra 32k or more out of your end user's 64megs of ram on Windows 98 is Not a Good Thing.

    .NET

    With Visual Studio .NET, aka, VC7, this header does not help as much as it does under VC6 - this is because Microsoft is not allowing the compiler options to be set from within the source code like before. You will have to add in the switches yourself - "/ignore:4078 /RELEASE /LTCG:NOSTATUS" in the Linker Command Line options, and "/GL /opt:nowin98" in the C++ Command Line Options. You should also add in "/GA" into your .EXE project's C++ Command Line Options, too. These will turn off the merging warnings, force release builds on, and perform whole code optimizations, in addition to removing the padding. The /GA option will turn on Windows Application optimization - only do this for EXE's, not DLL's.

    VC7 simply does not produce as tight as code as VC6 and VC5 does. The exact same code is padded out more, and uses bigger constructs. Benchmarking is hard on the Uber Box, so while this VC7 code might run faster, it's hard to prove it - perhaps on a slower machine where the runtimes would be more spread out. However, you generally want smaller code, in an effort to put as much into the CPU's cache as possible - keep it from hitting slower ram.

    Disassembling

    Interestingly, and I feel, an added bonus, once the .TEXT segments have been merged with the .DATA segments, the code will not longer be able to be disassembled by DUMPBIN (try it! DUMPBIN /disasm filename.exe) or WinDisasm or any other disassembly tool; you can still hack at it with SoftICE and the like, of course. Credit must be given to Gëzim Pani <gpani@siu.edu> for discovering this and asking "why?".

    Now, as to an explanation - as I see it. Code is supposed, by historic default, live within the .TEXT segment (why not .CODE? Good question). The /merge:.text=.data line causes the .TEXT and .DATA segments to be merged into .DATA, like this (summarized):

    Application (.EXE) Dynamic Link Lib (.DLL)
    C:>DUMPBIN Crc32.exe
        Dump of file Crc32.exe
        File Type: EXECUTABLE IMAGE
            Summary
                 2000 .data
                 1000 .rdata
                 1000 .rsrc
    C:>DUMPBIN CBase.dll 
        Dump of file CBase.dll
        File Type: DLL
            Summary
                 4000 .data
                 4000 .rdata
                 1000 .reloc
                 1000 .rsrc

    Neither of these files will disassemble, since there is no .text segments. Using DUMPBIN /header on the CRC32.exe file shows two important items: first, the entry point is at 38DF RVA (rva is an address into the relocation virtual address). This is squarely in the 2nd segment, .DATA, which starts at 2000 virtual address, and is 1CE8 long. What this means is that if you have some program that is hard-coded to expect raw code to be living in the .TEXT segment (such as the dissemblers!), then it's going to fail. As a test, I tried Shrinker from Blink-Inc (this is a runtime program compressor, that puts your dlls/exes in a runtime wrapper to compress/decompress in memory transparently to the program & user; for a freeware open source version, try UPX), and it worked fine. So unless something is hacking around with the .TEXT segment explicitly, then there is no problems. Since the only thing that I know of that does this is code modification tools and viruses, the question arises - does this provide any sort of anti-virus protection? Or does it in do the opposite, make it worse, by causing the virus scanner to fail? Oddly enough, neither Symantec nor McAfee would deem us worthy to answer our email - McAfee went as far as to demand that we subscribe to their anti-virus service first! I personally think that this will not cause a problem with the scanners, since they are looking for signatures - patterns within the files, which would be independent of how the program was put together. False positives always happen. However, this might not be true for the virii - if they patch the first .TEXT segment, they will fail. But if they walk the header and patch the entry point (which is how I think they operate, but who knows these days), then this will matter not to them. But since this is pure speculation (but with 20-some odd years of writing code to back it up), until and if we get a response from some anti-virus vendor, that is just a guess. 

    This article and source code are copyrighted © 1999-2002 by Todd C. Wilson (tcw@nopcode.com). No reproduction of this article may be made without proper clearance from the author. Free use of the source as described in the source files is allowed, but may not be claimed as your own work. You may not re-publish this article nor the attached files on any other web site or medium without prior permission; you may refer to NOPcode.com as to where to get it. You may, of course, use this in your own projects. If you are using this in your projects or example code and would like to let the world know, drop us a line!

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here

    About the Author

    Todd C. Wilson
    Web Developer
    United States United States
    Member
    I work when you don't. Sleep is for wussies.
     
    The answer is no, whatever the question is. You can't have it, you don't need it, and you'd just break it in five minutes if I give it to you anyways.
     
    If you're interested, my web site is at NOPcode.com and has lots of cool stuff with programming and a one-of-a-kind Audio Server.

    Sign Up to vote   Poor Excellent
    Add a reason or comment to your vote: x
    Votes of 3 or less require a comment

    Comments and Discussions

     
    You must Sign In to use this message board.
    Search this forum  
        Spacing  Noise  Layout  Per page   
    Questioncan it work on 2tb disk?membernhchmg15 Dec '10 - 22:49 
    I test on 2T Disk,a tool, 2T Disk Simulator,it simulate a 2TB disk,1024,2048,4096 bytes/secotr,this app can not work.I found this tool on http://www.2tdisk.com
    GeneralVisual Studio 2005/2008 and Windows Vista questionmemberJose David Pujo13 Oct '08 - 1:33 
    Great article. Greetings!
     
    I'd like to know if someone has done any performance tests compiling such optimizations with Visual Studio C++ 2005/2008 and Windows XPsp2 or Windows Vista as target Operting System.
    Thanks.
    GeneralCompatibility problem with WinXP SP2 NX ProtectionmemberOz Solomon6 Nov '05 - 8:52 
    I can't actually verify this because I don't have an Athlon64 or a Pentium with NX protection, but the following line will cause problems:
     
    #pragma comment(linker,"/merge:.text=.data")
     
    If I'm reading this right, it's telling the linker "code is data" which is exactly what XP SP2 doesn't allow (NX = "no execute" of data).
     
    -Oz
    GeneralRe: Compatibility problem with WinXP SP2 NX ProtectionmemberGary Chapman17 Nov '05 - 20:14 
    Hey Oz!
     
    I wish I'd found this message before spending the last 3 hours trying to work out why some of my COM DLLs were failing to register!
     
    I think you're definitely right - I'm running XP Professional SP2 on an Athlon64 system, and DEP won't allow regsvr32 to register DLLs that were built with this optimisation.
     
    Cheers,
     
    Gary
    Generalnuther testimonymemberalan9320 Sep '05 - 9:23 

    This is what some hacker wrote back about my software that I used this in:
     
    me:
    If your 30 day trial runs out and you want to test a newer version,
    let me know and I'll send you a temporary license code.
     
    HACK:
    Ok, though it would be easier just to crack it. Smile | :)
     
    HACK:
    Out of curiosity, your application has some "flaws" which make running
    a disassembler difficult (haven't really bothered trying too hard;
    dead-listing is not my style). Was that delibrate, or just a side
    effect of whatever compiler you use?
     
    me:
    snicker snicker
    GeneralAdd /filealignmemberRichard-SP16 Aug '05 - 1:52 
    To get a small exe in .NET add "/filealign:16 /align:16" to the linker command line in your release project.
     
    []'s
    Richard Natal
     
    --< Rick-SP >--
    Join to the best... Join to C++ developers
    Questioncombining with Pietrek's TinyLib?membercarla7195 Mar '04 - 1:41 

    I tried to combine Pietrek's code with AggressiveOptimize.h
     
    http://msdn.microsoft.com/msdnmag/issues/01/01/hood/
     
    I inserted the
     

    #include "AggressiveOptimize.h"

     
    as the first to each cpp, and then:
     

    nmake -f libctiny.mak
    cl hello.cpp libctiny.lib
    del *.obj

     
    The result -- EXE is the same (2.5 K), I can even see a .TEXT section with DUMPBIN.
     

    Dump of file hello.exe
    Summary
    1000 .data
    1000 .rdata
    1000 .text

     
    What am I doing wrong?
     
    Thanks.
    GeneralVery nice :)membersp1ke20 May '03 - 10:08 
    Works great, I wasn't concerned with size but rather with execution speed. My software performs several computational intensive tasks, mainly image processing algorithms. I managed to shave off 30ms of execution time which brings it close to a real-time behaviour, and this is a big improvement for me. Thanks Smile | :)
     
    Marius
    GeneralRe: Very nice :)memberTodd C. Wilson20 May '03 - 10:36 

    Generally, if this is happening, then the algorithm you're using is packing-sensitive - in other words, the instructions in the loop are all fitting within the CPU's cache, and a change in a totally unrelated section of code might cause the address of this bit of code to shift, making it NOT pack better. Not to mention that a different CPU stepping might cause slightly different results.
     
    You might want to spend the time profiling your code and hand-tuning it, and even consider manipulating some of it in raw assembly. Intel offers their VTune product as a 30-day eval, and while I'm not thrilled with what they tout it for, the only feature I found useful was a line-by-line display of execution time, so you can see how fast specific lines of code run and where to massage it at.
     


    "I was in a computer game. Funny as hell, it was the most horrible thing I could think of."

    GeneralVery nice :)membersp1ke20 May '03 - 10:07 
    Works great, I wasn't concerned with size but rather with execution speed. My software performs serveral computational intensive tasks, mainly image processing algorithms. I managed to shave of 30ms of execution time which brings it close to a real-time behaviour, and this is a big improvement for me. Thanks Smile | :)
     
    Marius
    GeneralExcellent Tipmemberlordelectro9 May '03 - 9:39 
    Very easy to impliment and has resulted in substantial gains for my project. I have many DLLs that were averaging 20KB-72KB (average having already had some .exe reducing tips applied to them). The larger DLLs (where there was actually a substancial amount of code and API calls) were reduced by about 20% in size, and some of the samller ones (resource libraries and such) to 3 or 4KB! This is exactly what I have been searching for, very good work!
     
    I haven't done any testing to see if any of this reduces RAM use, but a quick glance at the mem usuage output suggests some small savings there too.
    Generaljust a testimonymemberDavide Pizzolato31 Oct '02 - 23:10 
    I tested your header with cximage[^], the result is -10% in disk space and -15% in memory.
    It's a good result, but far from the 25% of your reports. 5 stars anyway Smile | :)
    GeneralGood pointmemberBoris Russel28 Oct '02 - 5:51 
    Often overlooked - For more info on the subject, check out the 'Under the hood' articel by Matt Pietrek (http://msdn.microsoft.com/msdnmag/issues/01/01/hood/default.aspx)
    GeneralRe: Cickety PolicememberDaniel Turini28 Oct '02 - 6:00 
    http://msdn.microsoft.com/msdnmag/issues/01/01/hood/default.aspx[^]
     
    lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
    GeneralA picture is worth a thousand wordsmemberTodd C. Wilson28 Oct '02 - 3:57 
    This is from a REAL WORLD project that is SHIPPING to our customers. It's a large project with lots of database usage, that runs within a mixed 95/98/me/xp/2k/xyz setting. This is from an excel spreadsheet; the filenames have been changed for NDA reasons.
    These results are 100% reproducable - please, if you are confused about if this works for you or not, first do your own benchmarks and then post them! Hey, let's have a compitition - who can get the most savings?
    NOTE: dunno how well this is going to paste in here..... I can email the orignal XLS file if anyone wants it...
     
    	Optmized with header:			Without header:		Savings	% smaller
    	Size (Bytes)	Filename		Size (Bytes)	Filename		
    	"199,168"	AdminDB.dll		"262,144"	AdminDB.dll	"62,976"	24.02%
    	"185,344"	AdminGUI.dll		"221,184"	AdminGUI.dll	"35,840"	16.20%
    	"114,176"	BillingGUI.dll		"151,552"	BillingGUI.dll	"37,376"	24.66%
    	"62,976"	CalendarDB.dll		"86,016"	CalendarDB.dll	"23,040"	26.79%
    	"137,216"	CalendarGUI.dll		"167,936"	CalendarGUI.dll	"30,720"	18.29%
    	"138,240"	ConditionalsDB.dll		"176,128"	ConditionalsDB.dll	"37,888"	21.51%
    	"198,144"	ConditionalsGUI.dll	"241,664"	ConditionalsGUI.dll	"43,520"	18.01%
    	"111,616"	ContactsGUI.dll		"143,360"	ContactsGUI.dll	"31,744"	22.14%
    	"60,928"	EMailDB.dll		"86,016"	EMailDB.dll	"25,088"	29.17%
    	"117,248"	EMailGUI.dll		"151,552"	EMailGUI.dll	"34,304"	22.64%
    	"88,576"	CoreBase.dll		"122,880"	CoreBase.dll	"34,304"	27.92%
    	"328,192"	CoreControls.dll		"401,408"	CoreControls.dll	"73,216"	18.24%
    	"128,000"	CoreDBMgr.dll		"184,320"	CoreDBMgr.dll	"56,320"	30.56%
    	"110,592"	CoreDialogs.dll		"135,168"	CoreDialogs.dll	"24,576"	18.18%
    	"307,712"	CoreToolkit.dll		"389,120"	CoreToolkit.dll	"81,408"	20.92%
    	"110,592"	Client.exe		"126,976"	Client.exe	"16,384"	12.90%
    	"431,104"	ClientComponents.dll	"561,152"	ClientComponents.dll	"130,048"	23.18%
    	"14,336"	ClientDBMgr.dll		"28,672"	ClientDBMgr.dll	"14,336"	50.00%
    	"367,616"	ClientDialogs.dll		"454,656"	ClientDialogs.dll	"87,040"	19.14%
    	"22,016"	ClientToolkit.dll		"36,864"	ClientToolkit.dll	"14,848"	40.28%
    	"230,400"	HoldingsDB.dll		"290,816"	HoldingsDB.dll	"60,416"	20.77%
    	"511,488"	HoldingsGUI.dll		"651,264"	HoldingsGUI.dll	"139,776"	21.46%
    	"77,312"	FolderListGUI.dll		"94,208"	FolderListGUI.dll	"16,896"	17.93%
    	"282,112"	OrdersDB.dll		"364,544"	OrdersDB.dll	"82,432"	22.61%
    	"120,832"	OrdersGUI.dll		"147,456"	OrdersGUI.dll	"26,624"	18.06%
    	"23,040"	SystemNotificationsDB.dll	"36,864"	SystemNotificationsDB.dll	"13,824"	37.50%
    	"85,504"	TaskDB.dll		"114,688"	TaskDB.dll	"29,184"	25.45%
    	"71,168"	TaskGUI.dll		"94,208"	TaskGUI.dll	"23,040"	24.46%
    	"6,144"	TitleDB.dll		"24,576"	TitleDB.dll	"18,432"	75.00%
    	"49,152"	TitleGUI.dll		"69,632"	TitleGUI.dll	"20,480"	29.41%
    	"229,376"	Services.exe		"229,376"	Services.exe	0	0.00%
    	"20,480"	ServicesNTLoader.exe	"20,480"	ServicesNTLoader.exe	0	0.00%
    	"77,824"	PDFout.dll		"77,824"	PDFout.dll	0	0.00%
    							
    	"5,018,624 bytes in 33 files and 2 dirs"	"6,344,704 bytes in 33 files and 2 dirs"		1326080	25.91%
    	"5,079,040 bytes allocated"			"6,352,896 bytes allocated"			Average savings
    Slop:	"60,416"	(118 512-byte clusters)		"8,192"	(16 512-byte clusters)		
    

     


    Visual Studio Favorites - improve your development!
    GUIgui - skin your apps without XP

    GeneralRe: A picture is worth a thousand wordsmemberTodd C. Wilson28 Oct '02 - 4:00 
    Almost forgot. Compressed sizes, using WinZip, Maximum compression:
    Optmized.zip - 1.73 MB (1,822,928 bytes) on disk: 1.74 MB (1,826,816 bytes)
    Unoptimized.zip - 2.01 MB (2,110,334 bytes) on disk: 2.01 MB (2,113,536 bytes)
     

     


    Visual Studio Favorites - improve your development!
    GUIgui - skin your apps without XP

    GeneralRe: A picture is worth a thousand wordsmemberMustafa Demirhan28 Oct '02 - 9:27 
    OK, that's what I say very specific cases. Most of you components are about 40-50 K and surely this will help in this case. Please read my reponse to Tim Kosse in the thread below.
     
    And, please, please do not take this as an offense. I may be rude in the beginning but I apologize for that. I just wanted to write my opinions. I did not mean to insult, or ..etc. And please continue writing more articles. This kind of comments should not dicourage you. Roll eyes | :rolleyes: This tip may not be helpful for me; but it may be very useful for somebody else. Blush | :O
     
    Mustafa Demirhan
    http://www.macroangel.com
    Sonork ID 100.9935:zoltrix

    They say I'm lazy but it takes all my time
    GeneralRe: A picture is worth a thousand wordsmemberTodd C. Wilson28 Oct '02 - 17:08 
    If it did not help for you, perhaps you could post your results. It would be interesting to see more metrics than just the projects me and the others are using with it.
     


    Visual Studio Favorites - improve your development!
    GUIgui - skin your apps without XP

    GeneralRe: A picture is worth a thousand wordsmemberMustafa Demirhan28 Oct '02 - 19:09 
    Todd C. Wilson wrote:
    If it did not help for you, perhaps you could post your results. It would be interesting to see more metrics than just the projects me and the others are using with it.
     
    Well, you did not get my point: I did not say that it does not help. It is just a very very very small reduction in the size. Nothing else!!!
     
    But just FYI, here are the results for one of my projects:
     
    Original .exe Size (without using the library): 4,112,483 bytes
    Size after optimization: 4,104,291 bytes
    Gain = 8,192 Bytes
    Gain in percentage = 0.199%
     
    Apart from the exe file, the project has 7 DLL files. All of the files have similar gains. So totally:
     
    The total size of the project before optimization: 7,626,752 bytes
    The total size after optimization: 7,553,024 bytes
    Total Gain = 73,728 bytes
    Total Gain in percentage: 0.96%
     
    As you see, in a real project the gain will be less than 1%. Also, this will be the case for most of the applications not your example. So tell me: Who cares about this 1% reduction in size?
     
    Mustafa Demirhan
    http://www.macroangel.com
    Sonork ID 100.9935:zoltrix

    They say I'm lazy but it takes all my time
    GeneralRe: A picture is worth a thousand wordsmemberTodd C. Wilson29 Oct '02 - 3:05 
    Mustafa Demirhan wrote:
    As you see, in a real project the gain will be less than 1%. Also, this will be the case for most of the applications not your example. So tell me: Who cares about this 1% reduction in size?
     
    I would suspect that you have already changed a lot of your compiler settings for this project, so what the header is doing, you've already done. If you read the article and the header, you'll notice that I mention that instead of farting around with the settings for each project, the header does it for you. If you wish to post your project's C++ options settings, we can see what you've done already do it. You might want to try resetting your project back to the default and compile it again without this header and see what it does.
     
    As for this being a real project or not, I have no idea what your project is or what it is doing. However, the projects I usually work on are corporate enterprise deliverables, and are much larger than a single exe and seven dlls. FYI, the real-world project that I gave as an example is used world wide by a Well Known Corporation, which is why I had to change the names to protect the NDA.
     
    Also, as mentioned, your milage may vary - nobody is forcing you to use this thing, but a lot of people have, and it has always helped. You seem to be more pissed off about the fact that it doesn't make your program super-spiffy, and only gives you 73k of savings - this I would chalk up to more of your OWN optimization settings more than anything else. You're trying to place "blame" for something where you've already done most of the same work!
     


    Visual Studio Favorites - improve your development!
    GUIgui - skin your apps without XP

    GeneralRe: A picture is worth a thousand wordsmemberMustafa Demirhan28 Oct '02 - 19:28 
    Here is another benchmark:
     
    File Size Before Optimization: 2,174,976 bytes
    File Size After Optimization: 2,039,296 bytes
    Gain: 135,680 bytes
    Percentage in gain: 6%
     
    In this project it has a much bigger gain; but again the gain in the file size is not important. But I did a test for memory usage and you were right. The optimized program uses less memory. Now, this I call gain Smile | :) I do not care about the HDD space but 100 KB of gain in the memory for each component is a quite good improvement. Sorry for being very harh before. Thanks for the code Wink | ;)
     
    Mustafa Demirhan
    http://www.macroangel.com
    Sonork ID 100.9935:zoltrix

    They say I'm lazy but it takes all my time
    GeneralRe: A picture is worth a thousand wordsmemberTodd C. Wilson28 Oct '02 - 17:16 
    Mustafa Demirhan wrote:

    One more thing: I think you also used MiniCRT. Right? If so, this picture is totally useless. Especially the compressed sizes will be nearly the same...

     
    Nope. Standard MFC42.dll MSVCRT.dll etc. The compressed sizes does not include the same 3rd party dlls, only the ones that are generated by the project and the build tools. MiniCRT is only of value if you are totally forgoing the *entire* Microsoft libaries, and this includes MFC, ATL, MSVCRT, etc, not to mention global objects. I wouldn't consider using MiniCRT or any similar libary (there are dozens) for anything bigger than a single console app.
     


    Visual Studio Favorites - improve your development!
    GUIgui - skin your apps without XP

    GeneralTotally ridiculous!!!memberMustafa Demirhan27 Oct '02 - 20:07 
    From the article:
    Why Not
    The argument can be made that doing this is a waste of time, since the "zero bytes" will be compressed out in a zip file or install archive. Not really - it doesn't matter if the data is a string of zeroes or ones or 85858585 - it will still take room (20 bytes in a zip file, 29 bytes if only *4* of them 4k bytes are not the same) and time to compress that data and decompress it. Also, 20k of zeros is NOT 20k on disk - it's the size of the cluster slop- for Fat32 systems, 20k can be 32k, NTFS could make it 24k if you're just 1 byte over (round up). Most end users do not have the dual P4 Xeon systems with two gigs of RDram and a Raid 0+1 of Western Digital 120meg Special Editions that all worthy developers have (all six of us), so they will need any space and LOADING TIME savings they will need; taking an extra 32k or more out of your end user's 64megs of ram on Windows 98 is Not a Good Thing.

     
    Just a lie. Totally ridiculous/wrong. Just trying to confuse people!
     
    Mustafa Demirhan
    http://www.macroangel.com
    Sonork ID 100.9935:zoltrix

    They say I'm lazy but it takes all my time
    GeneralRe: Totally ridiculous!!!memberChristian Graus27 Oct '02 - 20:40 
    Mustafa Demirhan wrote:
    Just a lie. Totally ridiculous/wrong. Just trying to confuse people!
     
    I must agree - your explanation makes so much more sense than the authors. Oh, wait a minute.....
     
    In other words, what the hell is your problem ? It's unlikely the author set out to lie/confuse, so if you know better, then everyone, the author included, would be interested to hear why. Without that explanation, all you're doing is blowing hot air...
     
    Christian
     
    No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
     
    Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
     
    During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002

    GeneralRe: Totally ridiculous!!!memberMustafa Demirhan27 Oct '02 - 21:44 
    It is all explained in the thread below!
     
    Mustafa Demirhan
    http://www.macroangel.com
    Sonork ID 100.9935:zoltrix

    They say I'm lazy but it takes all my time
    GeneralRe: Totally ridiculous!!!memberMustafa Demirhan27 Oct '02 - 21:48 
    By the way, I agree that I was rude. I really did not mean that. I just wanted to point out that these are wrong, but I was way too rude. I am rwally sorry for that. I apologize for being rude.
     
    Mustafa Demirhan
    http://www.macroangel.com
    Sonork ID 100.9935:zoltrix

    They say I'm lazy but it takes all my time
    GeneralRe: Totally ridiculous!!!sussKochise29 Oct '02 - 22:48 
    You wasn't rude at all, you was just "Aggressive" (that's the title of the thread) Wink | ;)
     
    Kochise
    GeneralRe: Totally ridiculous!!!memberTodd C. Wilson28 Oct '02 - 3:43 
    Well if I was unclear, let me know. But since a picture is worth a thousand words, I'll be posting a lovely little chart here...
     


    Visual Studio Favorites - improve your development!
    GUIgui - skin your apps without XP

    GeneralRe: Totally ridiculous!!!sussKochise29 Oct '02 - 22:45 
    I agree with Mustafa Demirhan ! It's the same for pocket digital camera ! Why should we save our pictures in packet JPEG when you can save them in plain unpacked TIFF on a 128 MB cartidge or IBM MicroDisc ? On PC, you will have soon gigabytes of memory, and terabytes of harddrives. Nobody would mind have an EXE of 145 MB just to display "Hello World !" on your screen. Nobody yet minds to have MicroSoft scerwing 140 MB of your main memory just after the boot, and 2 GB on your harddrive just to seat some useless assistants and drivers (drivers.cab - 75 MB - is loaded into the memory for immediate recognization of hot-pluged USB devices), when you have already these drivers supplied with your hardware. For whose cannot install them by hand, every one has to suffer from EXE/DATA size explosion.
     
    I remember that good old time when I coded in full assembly language a little video player that support resume, pause, forward, backward, zoom, supersampling, RGB and CYM filter, ... ONLY 4 KB !
     
    Kochise
    GeneralRe: Totally ridiculous!!!memberTodd C. Wilson30 Oct '02 - 1:58 
    Kochise wrote:
    [...]Nobody yet minds to have MicroSoft scerwing 140 MB of your main memory[...]
     
    Then maybe they should. Putting up with something just because Microsoft is too lazy doesn't make it right, and doesn't mean the rest of us should do it to. I guess you don't mind having 140 mb of spam in your mailbox per day, either, right? After all, terrabye drives grow on trees, and bandwidth is free. It's just a little extra space, means nothing. What's a few extra gig between friends, right?
     
    Uncompressed TIFF file: 3,400K. Compressed JPG with high quality: 395K. 128,000K memory card / 395K = 324 pictures. Or only 37 if you use your uncompressed tiff option. And that's with a 1.2 megapixel camera. But yes, raw images look better than uncompress LOSSY jpg images - and we're not talking images here, we're talking NON LOSSY code! Not data, code!
     
    I think both you and him are totally missing the entire point of this subject, but you are allowed to voice your opionion, even if you both are mistaken.
     


    Visual Studio Favorites - improve your development!
    GUIgui - skin your apps without XP

    GeneralRe: Totally ridiculous!!!sussKochise30 Oct '02 - 3:25 
    It was just a cynical answering Wink | ;) Have you ever understood why NO digital camera manufacturer ever implemented the fabulous PNG format, absolutely LOOSELESS, that save picture with bigger files than JPEG, but with AlphaChannel and no LOSS. Try http://www.libpng.org and http://www.libmng.org ! It ROCKS !
     
    I'm an embedded coder, an totaly ashamed to see and to be asked to code sh*t, "because if the consumer lack of memory, he will just have to buy some more", when I try to explain I takes further times to optimize my code. Strange 'political' behaviors Frown | :(
     
    I mostly use QNX (http://www.qnx.com) because there is no LOSS of any mean, neither drivers nor assistants. But still have to work on Windows, and expect I could delete from my harddrive/memory at least 'drivers.cab'. If I have to install some drivers, I can do it by myself, no needs to loose half of my main memory just for childnesses of most of the users.
     
    Yes, I'm feed up with this run of power, but beside when you code nicely, like I try to do, you have the benefit of megabytes of memory and gigabytes of harddrive, what allows you to do almost whatever you want.
     
    So leave MicroSoft screwing your memories, it is helpful for a few coders that still believes coding is an art that cannot only be learnt at school.
     
    I have a RTC 56k modem connection, and I perfectly know what pain it is to download a 10meg file. On Atari/Amiga computers, there was alot of program packers, such IcePacker, that was adding a file header containing a depacker code, while in the '.data' segment was the original code previously packed. I hardly found something like this. And on Windows, it's almost useless since there is alotsa buch of files surrounding the main program file. Solution : "ZIP THEM ALL" !
     
    Kochise
    QuestionWhy should one do that ?sussAlois Kraus21 Aug '02 - 23:10 
    I do not get the point why anybody should use this. Executables are always
    the least part of a software package. And more important the size of hard disks
    with 120 GB and more, is so big, that this is no longer an issue.
    E.g. If You would save 10 megs
    with this on a 120 GB disk You would save 0,0000008 % disk space.
     
    This is not far away from nothing.
    AnswerRe: Why should one do that ?memberBrian Azzopardi21 Aug '02 - 23:32 
    As the author mentioned in the article the code was for download from the internet so, using your example, saving 10mb is worth a hell of a lot. Taking a real-world example, even saving 50k is worth it to those on a 56k modem line.

     
    bibamus, edamus, cras moriemur
    [eat, drink, for tomorrow we die]

    AnswerRe: Why should one do that ?memberTodd C. Wilson25 Aug '02 - 6:41 
    You might want to think about things more before making such a blanket statement. Besides, your math is off by several orders there.
    First off, not everyone has 120gig disks - most users are still running 10 or 20 gig systems that are a few years old.
    Second, you're forgetting about cluster size. A 31k file will take a 32k cluster under Fat32,and a 33k file will take two 32k clusters - wasting 31k! (Actually, it will take 3 clusters at this point - the index cluster for anything larger than a single cluster which points to the clusters in the file, so the total is 96k for a 33k file. Maganify that by say the 870 files in Office and you get 55megs of waste).
    Third, smaller programs generally load faster AND TAKE LESS MEMORY on the system; again, most users (not developers!!!) have 128meg older systems.
    Fourth, exe's & dll's *are* the most important part - unless you're delivering a PDF file. What are you going to drive the data and bitmaps with? If you're thinking that binaries make up less of the install than say bitmaps or documentation, that totally depends on the product. On a nasty little port we just completed, the binaries are 47 megs total - and the help file is only 1.1 megs in size. And it's compressed, too, by the way.
    Fifth, and this is important, smaller files generally compress smaller (within reason - if you program is mostly bitmaps, it's not going to compress much different), which reduces download time over the dialup modems - which most users have.
    See what I keep harping on? End user, end user, end user. Developers are not end users - we generally have really beefy boxen, and tend to forget the real world doesn't have uber machines that can play Quake at 1,000fps.
    And nothing is always something.
     


    Visual Studio Favorites - improve your development!
    GUIgui - skin your apps without XP

    GeneralRe: Why should one do that ?memberMustafa Demirhan27 Oct '02 - 20:01 
    Todd C. Wilson wrote:
    You might want to think about things more before making such a blanket statement. Besides, your math is off by several orders there.
     
    I totally disagree with you. Alex has a very good point here.
     
    Todd C. Wilson wrote:
    First off, not everyone has 120gig disks - most users are still running 10 or 20 gig systems that are a few years old.
    Second, you're forgetting about cluster size. A 31k file will take a 32k cluster under Fat32,and a 33k file will take two 32k clusters - wasting 31k! (Actually, it will take 3 clusters at this point - the index cluster for anything larger than a single cluster which points to the clusters in the file, so the total is 96k for a 33k file. Maganify that by say the 870 files in Office and you get 55megs of waste).

     
    Not at all!!! This optimization DOES NOT help you to reduce the waste of the space by clustering. I can prove this easily with some basic math and stochastic. For example, if Office used this optimization, the waste caused by the clustering would again be 55 megs!!!
     
    Todd C. Wilson wrote:
    Third, smaller programs generally load faster AND TAKE LESS MEMORY on the system; again, most users (not developers!!!) have 128meg older systems.
     
    Not in this case. The optimization just removes some spare space. This does not eat from the memory. And about the speed: The bigger file may load even faster. You cannot make a statement like this. With this optimization, Windows has to do more operations for the memory allocation initially and this may cause the program to load slower. For example, in the Compiler Optimization, you have two options: Optimize for Speed and Optimize for Smaller Size. Try out both of these and you will see that the one optimized for speed is BIGGER than the one that is optimized for size. This means that, smaller files do not necessarily load faster!!
     
    Todd C. Wilson wrote:
    Fourth, exe's & dll's *are* the most important part - unless you're delivering a PDF file.
     
    Nope. Exe's and Dll's are generally very small. Even with very big projects, the executables do not exceed 3-4 megabytes. For example, I have a 70,000 line project and the total size of the executables and dll's are about 3 MB.
     
    Todd C. Wilson wrote:
    Fifth, and this is important, smaller files generally compress smaller (within reason - if you program is mostly bitmaps, it's not going to compress much different), which reduces download time over the dialup modems - which most users have.
     
    Totally wrong!! Smaller files do not compress smaller. For example, take a jpg and bmp of the same photo and compress them. The results will be pretty much the same. The jpg won't even compress because its already compressed. There are some certain "Information Theory" rules and they say that there is a certain limit on the compression and the LZW compression method generally gives outputs that are very close to this limit. So, in the end, when it comes to the distribution of the files on the Internet, you WILL NOT gain anything at all (because you will compress it and for both configurations you will get pretty much the same output).
     
    Anyway, all of your points are absurd and WRONG. Before judging somebody about having blank statements, look at your statements: They are all ridiculous.
     
    Mustafa Demirhan
    http://www.macroangel.com
    Sonork ID 100.9935:zoltrix

    They say I'm lazy but it takes all my time
    GeneralRe: Why should one do that ?memberTim Kosse28 Oct '02 - 1:57 
    Mustafa Demirhan wrote:
    Not in this case. The optimization just removes some spare space. This does not eat from the memory. And about the speed: The bigger file may load even faster. You cannot make a statement like this. With this optimization, Windows has to do more operations for the memory allocation initially and this may cause the program to load slower. For example, in the Compiler Optimization, you have two options: Optimize for Speed and Optimize for Smaller Size. Try out both of these and you will see that the one optimized for speed is BIGGER than the one that is optimized for size. This means that, smaller files do not necessarily load faster!!
     
    Well, you're comparing two completely different things. This optimization settings do a lot more, like loop unrolling, creating inline functions automatically etc...
    The aggressive optimize header just causes the compiler/linker use smaller padding, merge sections etc...
    The point is: If optimize for smaller size is already selected, why do programs still benefit from the aggressive optimizations?
    And even today, smaller files DO load faster! Before loading into the memory, I've to get them onto my harddrive, either by downloading or copying from a CD, both takes more time for larger files Wink | ;)
     
    Mustafa Demirhan wrote:
    Todd C. Wilson wrote:
    Fifth, and this is important, smaller files generally compress smaller (within reason - if you program is mostly bitmaps, it's not going to compress much different), which reduces download time over the dialup modems - which most users have.
     
    Totally wrong!! Smaller files do not compress smaller. For example, take a jpg and bmp of the same photo and compress them. The results will be pretty much the same. The jpg won't even compress because its already compressed. There are some certain "Information Theory" rules and they say that there is a certain limit on the compression and the LZW compression method generally gives outputs that are very close to this limit. So, in the end, when it comes to the distribution of the files on the Internet, you WILL NOT gain anything at all (because you will compress it and for both configurations you will get pretty much the same output).

     
    Well, this header does not compress files, it just removes unneeded data, and files with fewer data usually compress better.
    Try compressing any file where you've added 1000 zeros (or add any other data) anywhere and then compress the same file without the zeros: The last one will be smaller!
     
    ---
    Author of FileZilla FTP
    http://sourceforge.net/projects/filezilla

    GeneralRe: Why should one do that ?memberMustafa Demirhan28 Oct '02 - 9:19 
    Tim Kosse wrote:
    Well, you're comparing two completely different things. This optimization settings do a lot more, like loop unrolling, creating inline functions automatically etc...
     
    I just wanted to point out that with this optimization, the files may become smaller. But this does not mean that they load faster. The reason is the memory allocation. Now, in this case Windows have to do more operations in Memory Allocation.
     
    Tim Kosse wrote:
    Try compressing any file where you've added 1000 zeros (or add any other data) anywhere and then compress the same file without the zeros: The last one will be smaller!
     
    Even if I add 40 KB of 0's; the difference will be about 50-60 bytes. So, why do I bother myself to gain 50-60 bytes of data. Come on who cares about that...
     
    Also, even without compression: Suppose you have a huge project like MS Office. What's the total number of .exe and .dll components? In Office XP, its about 300-400. So what will you gain in the end without compression? About 12-16 MB out of hundreds of MB's. What I am trying to tell is that this is not a gain? If this can be considered as a gain, MS would put an option in their compilers.
     
    One more thing: The author talks about cluster size,...etc. This DOES NOT help in reducing cluster size. It has nothing to do with cluster size. The waste will again be the same. Also, the waste because of clustering in MS Office XP is not 55 megs. It is just 5 mges in my NTFS file system. Also, 80% of the components in Office XP are NOT dll's and exe's.
     
    What I am trying to tell is that author IS NOT RIGHT. These optimizations may help to reduce the size of each file about 40K; but THAT'S ALL. It does not help the program to load faster or use less memory or reduce the waste because caused by clustering.
     
    We are not in the late 80's. We are in early 2000's and things changed a lot. Even the poorest system now does not care about this benefit. This optimization *may be* useful in some very specific cases; but for a regular project it does not.
     
    Mustafa Demirhan
    http://www.macroangel.com
    Sonork ID 100.9935:zoltrix

    They say I'm lazy but it takes all my time
    GeneralRe: Why should one do that ?memberMarc Heiligers29 Oct '02 - 22:20 
    This has turned into quite an argument.
     
    From what I've seen, the gain for large projects is not significant. A gain of 40KB in a 4MB binary does not make a huge difference (in the region of 1%). On the other hand 40KB saving in a 400KB project does make a fairly big difference (in the region 10%).
     
    For loading time, methinks that smaller files will load faster. Why? Well one needs to look at the process that takes place when a file loads. But the first, and slowest part, is getting the file from the disk into memory. Disk access is gazillions of times slower than memory access. Even if Windows has to do more memory allocation for an aggressively optimized file (and I cannot see why it should) that should still be offset by the saving in time of loading from the disk.
     
    As for compiler optimization, it is my understanding that an optimizing compiler makes certain optimizations, such as loop unrolling, when compiling optimized for speed, which will increase the file size. A larger file will take longer to load. Its the execution that is optimized for speed not loading.
     
    Finally, as for cluster size. These optimizations do not decrease cluster size. Changing the file system might do that but not compiler optimizations. But that's not what the original author had to say. What he said was that by reducing the file size, you may also reduce the number of clusters used by the file on the disk, thereby reducing the amount of space used on the disk. So, if you have a number of files that are 60KB in size, and you reduce those by 30KB (for example) then the total disk space saving will be 64KB per file (two clusters)!! I don't think this is significant anyhow. For small applications, the disk space usage is small anyway. For large applications the saving is not that big to bigin with. However, this may again reduce loading time for small apps. Fewer clusters means fewer times to reposition the disk read head.
     
    Overall, I find these optimizations useful. And if memory usage is improved too (and I have not checked) then that's just an added bonus!
     

    ______________
    Marc Heiligers

    Not one shred of evidence supports the notion that life is serious.


    GeneralRe: Why should one do that ?memberTodd C. Wilson28 Oct '02 - 3:41 
    Tim basically answered you - but to recap, you're basically confused about what is compressed, what is not, and where the savings are from. And I have a nice chart showing the before and after results of a larger than 3 meg project. I really fail to see what you are trying to prove other than you haven't bothered to test it for yourself and perform your own benchmarks.
     


    Visual Studio Favorites - improve your development!
    GUIgui - skin your apps without XP

    GeneralRe: Why should one do that ?memberPhilippe Lhoste2 Dec '02 - 5:37 
    Mustafa Demirhan wrote:
    This optimization DOES NOT help you to reduce the waste of the space by clustering. I can prove this easily with some basic math and stochastic.
     
    OK, so prove it.
    I am not sure the point is that optimization will always reduce the waste of space by clustering. It can save space if the unoptimized exe/dll is just above the cluster size, and the optimization will reduce it just below. Note that this will depend on the system of the end user.
     
    Mustafa Demirhan wrote:
    With this optimization, Windows has to do more operations for the memory allocation initially and this may cause the program to load slower. For example, in the Compiler Optimization, you have two options: Optimize for Speed and Optimize for Smaller Size. Try out both of these and you will see that the one optimized for speed is BIGGER than the one that is optimized for size. This means that, smaller files do not necessarily load faster!!
     
    I doubt having Windows to do some more operations on memory will slow down the loading more than having to load some more KB from a slow hard disk (or even a fast one...).
     
    Optimize for speed doesn't mean it will load faster, it means it will execute faster! And indeed, optimizing for speed may need to unroll loops, to replace computed stuff by tables, etc. All techniques eating space. That depends on the needs of the application.
    An image processing application (or a ray-tracer) are better optimized for speed, we don't care they are large, and loading of the file is probably much faster than the requested operation, anyway.
     
    Mustafa Demirhan wrote:
    Exe's and Dll's are generally very small. Even with very big projects, the executables do not exceed 3-4 megabytes.
     
    Mmm, we are not in the same world... For me, loving to download and test small freewares, a 1MB download is quite big (but can be worth it)... As stated in the article, this optimization is mostly worth for small programs, and is spectacular for very small ones.
    I have written small utilities, I confess they are bloated to almost 20KB because I played with the icon editor and added an icon with several resolutions, taking half of the end size...
     
    Mustafa Demirhan wrote:
    For example, take a jpg and bmp of the same photo and compress them. The results will be pretty much the same. The jpg won't even compress because its already compressed.
     
    Bad example, as you state, since the JPG file is already compressed, it won't be compressed more.
    And you are comparing the compression of exe/dll with the compression of compressed files. The first compress quite well (frequently around 50%), the second won't.
    Don't compare different things.
     
    Now, I don't believe in the first statement ("smaller files generally compress smaller"), because most compression algorithms take the frequently met patterns and replace them with smaller patterns. So with a big file, we can get more similar patterns.
    Now, I have done a few tests, and the answer is that there doesn't seems to be a final rule, the compression ratio is quite variable...
     
    Final note: this discussion is interesting, giving the readers a choice. All in all, it is up to the users to choose to use or not these optimizations.
     
    Philippe Lhoste (Paris -- France)
    Professional programmer and amateur artist
    http://jove.prohosting.com/~philho/

    AnswerRe: Why should one do that ?sussAnonymous9 Oct '02 - 11:24 
    have you ever heard of the demo scene, our 3d demos fits in 64k, strings, procedural textures, compression algo, music, b-splined camera, etc.. all that in a 64k .exe file.
     
    and there's games which need 2GB+ to install... only if the coders knew how a computer work it would fit in 250MB or less.
    GeneralRe: Why should one do that ?memberAlois Kraus10 Oct '02 - 6:10 
    Real programers do not use C++ perhaps C. They code their Demos in assembler Poke tongue | ;-P
    Did that by myself some years ago. This is rather intellectual sport than serious
    programming. The time to shrink the executable below a certain limit exceeds the
    pure implementation time by a factor of 2-5.

    GeneralOne line does it allmemberem12 Jun '02 - 17:11 
    http://mitglied.lycos.de/yoda2k/snippets/SmallVcExe.zip
     
    ^ Yoda shows you how to do it with just one line and one setting of a linker switch, the link is a download to a sample on his site at http://mitglied.lycos.de/yoda2k/
     
    Wink | ;)
    GeneralMFC App : Remove std resourcememberPeous7 Nov '01 - 1:35 
    You can also remove this line in yourprojectname.rc
     
    //#include "l.fra\afxres.rc" // Standard components
     

    Generalcan't beat UPXsussTom Grandgent8 Sep '00 - 6:00 
    I tried this header file with VC++ 6 SP3 and some of my Win32 (non-MFC) apps and it helped a little ... though one app went from 139k to 328k! Using the header (and _MERGE_RDATA_) only saved 2k after compression. I just UPX on everything - it has not failed me ever, not once, since I started using it a couple years ago (when it was still DJP).
     
    -To
    GeneralRe: can't beat UPXmemberIronHand22 Jan '02 - 5:07 
    As far as I can see, You just don't get the point! It is obvious, that You always save few kilobytes in size using this kind of optimization. And it is the only way to reduce small program size. Try using UPX with 'hello world' programs. You will get larger file than linking everything in some different way, aligning data, etc. If You are doing a BIG program, which is loaded into memory _once_ - UPX is Your solution. But only then! It is how to minimize small exe, how to make it even smaller.
     
    Peace!Big Grin | :-D
    GeneralRe: can't beat UPXmemberTom Grandgent22 Jan '02 - 6:36 
    It was my understanding that this particular optimization eliminated runs of empty space within the executable. If that's true, UPX will accomplish the same thing with less effort and less risk.
     
    Don't get me wrong, I'm all for aggressive optimizations when they are appropriate... but if they don't buy me anything over UPX, why bother?
    GeneralRe: can't beat UPXmemberTodd C. Wilson22 Jan '02 - 8:39 
    You might want to re-read the notes in the header file and look up what the optimization switches do in MSDN; they do not remove empty space, it reduces what is there, making the link packing smaller. This takes up less space on disk *AND* in memory when the PE image is loaded.
    When UPX loads a program, it pulls the *entire* image into RAM in order to decompress it; it does not decompress chunks (unless someone has made serious modifcations to it very recently), so the OS cannot page the PE or resource data as needed.
    You're making the assumption that what the optimizations do are the same as what UPX does. They are *not* the same - you're *compressing* a file in order to save space on the drive, whereas, you're *optmizing* the compile & link process to move code closer together to save runtime space & gain some speed. You're also assuming that UPX is a risk-free tool which is dead wrong. It has it's own risks with programs that don't like / cannot be compressed, and with low-memory systems.
    So your tradeoff is a smaller file on the harddrive, vs. a larger shipped & zipped install file (zip a zip file) + longer load time (decompress) + bigger memory footprint (after decompress).

    GeneralRe: can't beat UPXmemberJim A. Johnson22 Jan '02 - 6:47 
    What on earth is UPX?
    GeneralRe: can't beat UPXmemberTodd C. Wilson22 Jan '02 - 8:30 
    It's a compression loader for programs. Like PKzipLite, or Shrink-IT. Very similar to a self-extracting archive (zip/rar/arc). There is code example on codeproject that shows how to do things like this (put a loader front end on a package of code). This can be helpful if you have a program with lots of text and bitmaps in it; it doesn't help much with small programs, which is the same problem you get into with SFX files in general.

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Permalink | Advertise | Privacy | Mobile
    Web02 | 2.6.130516.1 | Last Updated 27 Oct 2002
    Article Copyright 2000 by Todd C. Wilson
    Everything else Copyright © CodeProject, 1999-2013
    Terms of Use
    Layout: fixed | fluid