delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/08/18/12:00:25

To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Speed tuning programs
Date: Thu, 18 Aug 1994 13:31:19 +0100
From: Olly Betts <olly AT mantis DOT co DOT uk>

Okay, I've found a larger data set (I couldn't find the one which only
just fits in conventional memory though).

BCC -Os   19.12-19.34 seconds
DJGPP -O2 18.02-18.18 seconds

So DJGPP seems to do better on larger data sets.  This one is quite
interconnected and results in a 54x54 matrix to solve.

From the output of gprof, this run calls strncmp over 2900000 times, all
but a handful of these calls being from the same point in the code.
Looks like an excellent candidate for inlining, so I tried adding a
prototype:

inline char* strncmp( const char*, const char*, size_t);

at the top of the file and turned -Winline on.  However, recompiling
gave a warning that it couldn't inline strncmp here.  In case it's
relevant, the code around the call is:

   while ((ptr!=NULL) && (cmp=strncmp(ptr->ident,name,IDENT_LEN))<0)
    {
    ptrPrev=ptr;

cmp is checked for =0 if it drops out of the while loop - the code is
scanning an order linked list.

Is there some way to get it to inline strncmp()?  Or do I need to write
my own version (or use the source from the library) which is declared
as inline in the source file?

Olly

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019