tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] ld.elf_so - Cache objects checked



On Wed, Feb 24, 2010 at 08:48:00PM +0000, Roy Marples wrote:
> 
> >Also a C loop for the name compare works faster than strcmp().
> 
> I would be suprised if this would help that much here.

It is a massive gain!
gcc inlines strcmp() to a 'rep cmpsb' instruction.
Since what is being searched is a hashed list, it almost always fails
on the first byte.
However the setup cost for 'rep cmpsb' is something like 40 clocks
on some x86 cpus (netburst P4 are very bad).

Since the string table hash table has slightly less that 'the power of
2 below the number of strings' entries, you do about 1.5 such compares
per shared library during symbol lookup.

One the symbol tables info for each shared library has been faulted in,
the name compare dominates the symbol lookup.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index