pouët.net

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
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
- 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.
added on the 2005-02-12 21:58:11 by kusma kusma
Quote:
- play burnout3 on xbox all day instead of coding.


master tip!
added on the 2005-02-12 22:01:38 by superplek superplek
- 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 :)
added on the 2005-02-12 22:19:19 by rmeht rmeht
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.
added on the 2005-02-12 22:27:25 by Hatikvah Hatikvah
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!
added on the 2005-02-12 22:54:15 by kusma kusma
fuckings to various people. but not to jumalauta.
added on the 2005-02-12 22:55:50 by kusma kusma
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...
added on the 2005-02-13 00:31:40 by blala blala
blala : i'd say it's still a bad idea to do 64k intros in asm in 2005 XD
added on the 2005-02-13 01:16:42 by apricot apricot
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 :)
added on the 2005-02-13 01:40:39 by rmeht rmeht
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.
added on the 2005-02-13 10:51:27 by Ger Ger
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.
added on the 2005-02-13 13:22:36 by blala blala
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)
added on the 2005-02-13 16:44:56 by KK KK
kusma: the point was just that you really dont need size optimized code very often in 64ks.
added on the 2005-02-13 17:09:45 by Hatikvah Hatikvah
agree on this
added on the 2005-02-13 19:22:56 by blala blala
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.
added on the 2005-02-13 21:12:46 by kusma kusma
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...
added on the 2005-02-13 21:16:50 by kusma kusma
kusma
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 :)
added on the 2005-02-14 03:16:45 by rmeht rmeht
Quote:
- play burnout3 on xbox all day instead of coding.


I dunno, I prefer burnout2 for the crash bits.
added on the 2005-02-14 14:17:13 by Shifter Shifter
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. :)
added on the 2005-02-19 22:54:56 by KK KK
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.
added on the 2005-02-20 15:02:37 by Preacher Preacher
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.
added on the 2005-02-20 17:00:57 by KK KK

login