Switch implementation based on circumstances.

Ondřej Bílka neleai@seznam.cz
Thu Dec 6 17:53:00 GMT 2012


Hi, 

I noticed that at several places we can use fast implementation most of
time and switch to more generic one only after some function is called.

This mostly applies to fact that in single thread programs locking is
not needed. I want to do something like compile file twice first time
with locks on and second off. Then I would and hook in pthread_create+shmat 
that switches implementation. 

malloc, printf ... would benefit most from this one.

Second is locale depended optimalizations where a hook for setlocale is
needed.

I do not know what is best way to collect hooks. One possibility is single 
file where you write all affected functions.



More information about the Libc-help mailing list