optimizing size for 4k/64k
category: general [glöplog]
some tips/links for optimizing exe size for 4k/64k?
more interested in compiling/linking size optimizations than data compression schemes
more interested in compiling/linking size optimizations than data compression schemes
what platform?
all of: windows, mac, linux
the total of my knowledge now is:
gcc - compile with -Os
visual studio - ???
also, is it always true that asm < c < c++ in size?
i usually code in c++ but fear it's not possible to make it small
the total of my knowledge now is:
gcc - compile with -Os
visual studio - ???
also, is it always true that asm < c < c++ in size?
i usually code in c++ but fear it's not possible to make it small
- generate all data that is trivial to generate
- don't use gcc (really! gcc sucks bigtime at this)
- please your packer (in general: group similar data, preferably byte-wise)
- write general code that can be used a lot of times
- walk, talk and act like chaos (but it'll degrade your position with the ladies)
- in visual studio (the only compiler you should ever use in windows), if you have to use stdlib, consider either using msvcrt.dll or winapi-equalients to the needed functions)
- don't use stuff like exceptions. in fact, turn it of.
- also, don't use stl
- drink more beer. beer is good for you.
- play burnout3 on xbox all day instead of coding.
- don't use gcc (really! gcc sucks bigtime at this)
- please your packer (in general: group similar data, preferably byte-wise)
- write general code that can be used a lot of times
- walk, talk and act like chaos (but it'll degrade your position with the ladies)
- in visual studio (the only compiler you should ever use in windows), if you have to use stdlib, consider either using msvcrt.dll or winapi-equalients to the needed functions)
- don't use stuff like exceptions. in fact, turn it of.
- also, don't use stl
- drink more beer. beer is good for you.
- play burnout3 on xbox all day instead of coding.
Quote:
- play burnout3 on xbox all day instead of coding.
master tip!
- avoid the WinMain
- avoid too many dll imports
- write your own code instead
- bless inline assembly where's needed
- msdn.microsoft.com and learn how to setup a project in order to get a valid 500byte empty executable
- lot of other tips i can't recall
- and indeed, drink lot of beer :)
- avoid too many dll imports
- write your own code instead
- bless inline assembly where's needed
- msdn.microsoft.com and learn how to setup a project in order to get a valid 500byte empty executable
- lot of other tips i can't recall
- and indeed, drink lot of beer :)
hmm, kolme missifitti used... stdlib, exceptions (everywhere), 100% classes, some template, just for testinga and as usually it was impossible to reach the 64k limit.
i should say, think about your data, you will have to be rather stupid to get the code to grow alot.
i should say, think about your data, you will have to be rather stupid to get the code to grow alot.
stefan: well, yeah, but kolme missifitti isn't a good example of size optimized code. ;)
rmeht: most of those are 4k-spessific.
let me clarify. for a 4k the optimizing-"rules" are completely different than on 64k. but still, no matter how you look at it, higher level "optimizations" will always beat the lower level ones.
anyways. kewlers suck!
rmeht: most of those are 4k-spessific.
let me clarify. for a 4k the optimizing-"rules" are completely different than on 64k. but still, no matter how you look at it, higher level "optimizations" will always beat the lower level ones.
anyways. kewlers suck!
fuckings to various people. but not to jumalauta.
Quote:
also, is it always true that asm < c < c++ in size?
if you can write _proper_ asm code, then yes, asm is smaller, on the 4k level at least. i think that it is still a good idea to do 4k intros in asm, even in 2005...
blala : i'd say it's still a bad idea to do 64k intros in asm in 2005 XD
Quote:
rmeht: most of those are 4k-spessific.
non at all.
Quote:
let me clarify. for a 4k the optimizing-"rules" are completely different than on 64k
not at all again. try yourself. write a simple "hello world" in a msgbox with those rules and pack it with (eg, mew). saving 1kb of space isn't so bad, even in a 64k.
Quote:
but still, no matter how you look at it, higher level "optimizations" will always beat the lower level ones
i agree :)
spending 1 day on a structural change in C++ might optimize 1kb, the same day spent on rewriting some of the C++ code to asm might save 10 to 100 bytes.
I didn't say "rewriting c in asm" - asm needs different thinking. you can spend weeks optimizing your 4k, but it is possible to do things which are not possible in c, imho.
Additional on-topic question from me: How do you deal with matrices in D3D in 4k? I can do my own matrix functions, but it seems to be wasting too much space. Is there any way around it? (like linking with both D3D and OpenGL)
kusma: the point was just that you really dont need size optimized code very often in 64ks.
agree on this
rmeht: striking arguments. really, stuff like skipping WinMain and and dll-imports are totally useless in 64ks. the development-time saved and the maintainability easily beats the < 1k you save on these things. optimize the things that make the biggest impact first. allways.
megadelux: true indeed.
megadelux: true indeed.
Kryzysiek-K: you could use gl and glu for some matrix-functions, but i doubt it would help you anything at all, since you'd have to do gl-setup etc. besides, you could always just do simple matrix-"hacks", like having a constant projection-matrix and simply storing it in the executable. rotation- and transformation-matrices aren't the most space-consuming routines...
kusma
well, since they're pretty simple to apply, why not ? :)
and the code maintenance of the code isn't so fucked up though. (imho)
i agree again :)
Quote:
striking arguments. really, stuff like skipping WinMain and and dll-imports are totally useless in 64ks. the development-time saved and the maintainability easily beats the < 1k you save on these things.
well, since they're pretty simple to apply, why not ? :)
and the code maintenance of the code isn't so fucked up though. (imho)
Quote:
optimize the things that make the biggest impact first. allways.
i agree again :)
Quote:
- play burnout3 on xbox all day instead of coding.
I dunno, I prefer burnout2 for the crash bits.
You may be interrested in this: in new DirectX SDK release d3dx code was moved from .lib to .dll. I'm looking forward to seeing some cool 4k in near future. :)
so ... just because lot of 3D stuff is provided by d3dx as part of a system dll, any moron will be able to code a 4k ... how great
4k intros coded by morons in the future will suck, just like productions coded by morons suck now.
Well, you get some new possibilities for 4k intros and I don't consider it too bad. Probably some people who wasn't able to make 4k will start making poor ones, but people good at it will make even more stunning 4k's.