[PATCH] _dl_find_hash: optmizie symbol lookup delaying stringcomparisons

Carmelo AMOROSO carmelo.amoroso at st.com
Thu Oct 4 17:59:33 UTC 2007


Joakim Tjernlund wrote:
> Hi Carmelo
>
> This has been up before and I am not convinced it is a gain.
> The if (sym->st_value == 0) and if (ELF_ST_TYPE(sym->st_info) > STT_FUNC)
> are mostly false.
>
> Suggest you get some numbers before applying this patch.
>
> Jocke
>
Joakim Tjernlund wrote:
> Hi Carmelo
>
> This has been up before and I am not convinced it is a gain.
> The if (sym->st_value == 0) and if (ELF_ST_TYPE(sym->st_info) > STT_FUNC)
> are mostly false.
>
> Suggest you get some numbers before applying this patch.
>
> Jocke
>
Hi Jocke, here they are the numbers you were asking for ;-)

I've run the uClibc testsuite (using sh4 nptl as usual for me :-) )
to collect data.

I've executed them (316 tests) in 4 different scenarios:

1) SysV hash - *no* strcmp patch
2) SysV hash - *with* strcmp patch
3) GNU hash - *no* strcmp patch
4) GNU hash - *with* strcmp patch

To get figures, I have hacked the ld.so adding a variable
to count how many times the ld.so calls a strcmp to check
for a symbol matching and it fails, printing it to stderr
before the linker passes the control to the application.

SysV hash
-----------
Using the old SysV hash style, I've found that, in some case,
there is no difference, while in others, without this patch,
the linker calls much more strcmp before finding the matching symbols.
Never with the patch it does more comparisons.

GNU hash
--------
Using the new GNU hash style, with or without the patch,
the ld.so does *NOT* call any time strcmp and it fails.
This is really a great achievement of the new algorithm.
Probably other tests may show some differences


These globally are the data collected.
I cannot attach the spreadsheet because it's too bigger.
I can send directly to anyone interested.

         
-------------------------------------------------------------------------------------- 

         | SysV no patch | SysV patched | SysV delta | GNU no patch | 
GNU patched | GNU delta |
------------------------------------------------------------------------------------------------ 

|Total    |        203522 |       182113 |    + 21409 |            0 
|           0 |        0  |
|Average  |          1280 |         1145 |      + 135 |            0 
|           0 |        0  |
------------------------------------------------------------------------------------------------ 


Comments are welcome !

Regards,
Carmelo




More information about the uClibc mailing list