Subject: Re: CVS commit: basesrc/libexec/ld.elf_so
To: Simon Burge <simonb@wasabisystems.com>
From: Bang Jun-Young <junyoung@netbsd.org>
List: source-changes
Date: 12/06/2002 11:14:06
On Fri, Dec 06, 2002 at 12:52:42PM +1100, Simon Burge wrote:
> Bang Jun-Young wrote:
> 
> > Module Name:	basesrc
> > Committed By:	junyoung
> > Date:		Thu Dec  5 04:56:57 UTC 2002
> > 
> > Modified Files:
> > 
> > 	basesrc/libexec/ld.elf_so: load.c map_object.c rtld.c rtld.h
> > 
> > Log Message:
> > 
> > A bit speedup: in _rtld_load_object(), save the number of calls to
> > strcmp() by performing path name length comparison first. In the test
> > with Mozilla, the number was reduced to 1068 from 7182 (yes, we saved
> > 6114 strcmp()!).
> 
> I'm a little curious how much faster this change is...
> 
> >From the diff, it seems we now unconditionally strlen() each path which
> means that the full length of the path is read and checked (looking for
> the NUL byte) instead of the strcmp() stopping at the first different
> byte.  What was the number of strlen() calls before and after this
> change?  Maybe also interesting would be the average path length...

n(strlen()): 0 -> ~580 

We still get 5600 strcmp() savings (not considering that strlen() is less
expensive than strcmp()). If you're running Mozilla on a quite slow machine,
you may be able to notice the difference.

And the average path length is quite long, since Mozilla specific shared
objects reside in /usr/X11R6/lib/mozilla.

Jun-Young

-- 
Bang Jun-Young <junyoung@netbsd.org>