Date: Sun, 13 Oct 2002 07:58:55 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Leonid Pauzner cc: djgpp AT delorie DOT com Subject: Re: profiling with DJGPP In-Reply-To: <2.7.9.GKAP.H3VJYA@pauzner.dnttm.ru> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sat, 12 Oct 2002, Leonid Pauzner wrote: > > In general, time functions _are_ heavy, since the computations are > > non-trivial and require iterations in some cases. You shoulod try to > > avoid calling time functions in inner loops of your program. > > That is about clock()/CLOCKS_PER_SECOND - is it portable across UNIXes > and shows correct number of seconds in true multitasking environment? Yes, `clock' is an ANSI standard function, so every Unix platform nowadays should have it. > Just indexing by the first letter of the environment variable name > may speeds up getenv by the factor of 10. If you can come up with a patch to getenv that speeds it up tenfold, I'm sure it will be gratefully accepted. > > Only once: the time functions cache the values of environment > > variables. If your program changes the environment a lot (by calling > > putenv or setenv, for example), then caching could be ineffective, > > since each time the environment changes, time functions must see if > > some of their variables changed as well, and take note. This is so > > that setting TZ to a different value is correctly handled. > > No! > The profile shows - each tzset force calling tzsetwall > (TZ variable is not set in my environment). Then do set TZ. Every well-set DJGPP installation should have TZ set to something appropriate, especially if you are running Unix programs.