Message-ID: <35B38619.4E02@teleline.es> Date: Mon, 20 Jul 1998 20:02:01 +0200 From: Mariano Alvarez Fernández Reply-To: malfer AT teleline DOT es Organization: teleline.es MIME-Version: 1.0 To: Eli Zaretskii CC: djgpp AT delorie DOT com Subject: Re: About DJGPP v2.02, more results References: Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Precedence: bulk Eli Zaretskii wrote: > > On Mon, 20 Jul 1998, Mariano Alvarez Fernández wrote: > > > 0.87 479.39 4.33 2688065 0.00 0.00 strtol > > This (and other) entries indicate that you convert strings to integers > quite a lot. You might consider storing the integer values instead, > to cut the number of these conversions. I know, but I use dbf format to store data-bases. > > > 0.63 482.56 3.17 5284125 0.00 0.00 strcopnb > > 0.52 485.17 2.61 5284126 0.00 0.00 strncpy > > 0.48 487.56 2.39 5284125 0.00 0.00 strlen > > These entries seem to imply that you call strlen for each call to > strcpy/strncpy. It would be faster to call memcpy/memmove instead, > since once you know the length of a string, there's no reason to use > the string-copy functions (which are slower because they look for the > terminating null character). It's the dbf format too. In dbf char strings are blank filled, I use null terminated strings internally, strcopnb do the input conversion. int strcopnb( char *dest, char *org, int max ) { int i; strncpy( dest,org,max ); dest[max] = '\0'; max = strlen( dest ); for( i=max-1; i >= 0 && dest[i] == ' '; i-- ); dest[i+1] = '\0'; return 0; } Regards, M.Alvarez.