This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Switch implementation based on circumstances.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: libc-help at sourceware dot org
- Date: Thu, 6 Dec 2012 19:40:42 +0100
- Subject: Switch implementation based on circumstances.
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.