Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

NaliXL

What makes a small program?

This topic is 5937 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Or, what makes an executable grow bigger? Say that if I want to write a 64K OpenGL demo, what kind of things would I have to keep in mind while programming, not looking at things like textures etc, but really coding techniques? For example : does a "uses" (a.k.a. include) statement to unused code enlarge my executable, or will the compiler ignore it, as it is not used? BTW : I''m using Borland Delphi to code my programs, if that makes any difference...

Share this post


Link to post
Share on other sites
Advertisement
I tellz you what. Depends on the compiler. Delphi is awesome though. I think you''re fine. MSVC++ 6 is also rather decent.

Good compilers don''t include code that is guaranteed not to be used in the EXE. When you use some of the functions from the standard includes, you may unknowingly drag in a whole chain of functions that the function you used depends on.

Example (in C++): including iostream.h makes your file grow by something like 350k. Crazy stuff. (that''s one of the reasons I don''t normally use streams).

I''m not sure what units the size of a delphi app would depend on, but I think delphi apps are quite large in general, since they include a whole visual library. For a simple programme, you''re looking at something like 400 KB at least.

BTW, why would you care about the EXE size anyway?

------------------------
CRAZY_DUSIK* pCrazyDuSiK = new CRAZY_DUSIK;
pCrazyDuSiK->EatMicroshaft(MS_MUNCH_BILL_GATES | MS_CHEW_BILL_GATES);

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If you want to do a 64kb program, the best is that you program in win32 asm, using TASM5 or MASM32, and you need to aply techniques of optimization of size, and to use ONLY the part of opengl libraries what you need.
Sorry of my english

Share this post


Link to post
Share on other sites
quote:
Original post by dusik
Example (in C++): including iostream.h makes your file grow by something like 350k. Crazy stuff. (that''s one of the reasons I don''t normally use streams).

It is not that much. Try a cout "hello world" vs an printf "hello world" and you''ll see the difference is less than 200k, and that''s in debug mode. With optimisations on it''s likely to be even less.



[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]

Share this post


Link to post
Share on other sites
i honestly know nothing of delphi, but the most obvious answer to reducing executable size would be to dynamically link to as many things as possible, i.e. leave as much code outside of your executable as possible. more demo oriented sites might have more information about this, maybe cfxweb.net or similar?

ewen

Share this post


Link to post
Share on other sites
I dont know why people care so much about the size of the exe its no big deal really. I mean who gives a rats arse...

Share this post


Link to post
Share on other sites
I''ve been doing contract work in delphi the past few months again so I''ll put in my 2 cents.

Lets say we have a tiny delphi app like this


  
program Project2;

uses
Forms,
Unit1 in ''Unit1.pas'' {Form1};

{$R *.RES}

begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.


Tiny huh? Not, it''s 307KB

But if you drop the uses Forms and the other code, its only 17KB, better huh, so you will have to get a window the manual way, that should keep the size down.

Also have a look at these links

http://www.theproduct.de/index.html
http://upx.sourceforge.net/

Share this post


Link to post
Share on other sites
Thanks for your input guys!

Yes, I know theproduct and UPX. More of this stuf at http://farb-rausch.de/ . Very nice!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!