Message-Id: Comments: Authenticated sender is From: "Salvador Eduardo Tropea (SET)" Organization: INTI To: oohoseoo AT aol DOT com (OoHOSEoO), djgpp AT delorie DOT com Date: Wed, 19 Aug 1998 12:42:46 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: system() bloat! what's going on? In-reply-to: <1998081521243700.RAA18260@ladder03.news.aol.com> Precedence: bulk oohoseoo AT aol DOT com (OoHOSEoO) wrote: > I just checked a program I recently compiled and found it's size to be > abnormally high. After looking through the source I found that it was due to > the system() functions.. after commenting the system() function out the code > what a nice 38k, with the system() function in the code it was damn near double > that! 72k. A friend told me that it may be related to the overhead necessary > to switch back into real mode. So what's the story.. and is there a way to > reduce this? After all, I could probably just write the function that performs > the same as the program I am calling through system(). I think you must take a look to the system help in the libc help (if you are using RHIDE just put the cursor over the call and press Ctrl+F1). After reading it you'll realize that system isn't just a call to the DOS' exec service. If you still in doubts just take a look to the sources. There are a lot of "magic" inside system to call other DJGPP programs passing hyperlong command lines, calling a shell for scripts, avoiding command.com for silly requests, etc, etc. If you can do it in your code avoid calling an external program. DOS isn't UNIX and calling another program costs too much in terms of performance and resources. SET ------------------------------------ 0 -------------------------------- Visit my home page: http://set-soft.home.ml.org/ or http://www.geocities.com/SiliconValley/Vista/6552/ Salvador Eduardo Tropea (SET). (Electronics Engineer) Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org ICQ: 2951574 Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA TE: +(541) 759 0013