Package: libasound2 Version: 1.0.21a-1 Severity: normal Tags: patch In a call to snd_device_name_hint, snd_dlopen is frequently called with the parameter name == NULL, meaning to open libasound.so itself. In this case, snd_dlopen calls dladdr on every call to find out the path to libasound.so. I am attaching a simple patch to cache this path within snd_dlopen so that dladdr is called only once; with this patch, the execution time of snd_device_name_hint (a somewhat slow call) is reduced by 40%.
Peace, John Lindgren -- System Information: Debian Release: squeeze/sid APT prefers testing APT policy: (500, 'testing') Architecture: i386 (i686) Kernel: Linux 2.6.30-2-686 (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages libasound2 depends on: ii libc6 2.9-25 GNU C Library: Shared libraries libasound2 recommends no packages. Versions of packages libasound2 suggests: ii libasound2-plugins 1.0.21-1 ALSA library additional plugins -- no debconf information
--- dlmisc.0.c 2009-09-09 08:34:54.000000000 -0400 +++ dlmisc.c 2009-10-24 11:18:51.000000000 -0400 @@ -54,9 +54,13 @@ #else #ifdef HAVE_LIBDL if (name == NULL) { - Dl_info dlinfo; - if (dladdr(snd_dlopen, &dlinfo) > 0) - name = dlinfo.dli_fname; + static const char * self = NULL; + if (self == NULL) { + Dl_info dlinfo; + if (dladdr(snd_dlopen, &dlinfo) > 0) + self = dlinfo.dli_fname; + } + name = self; } #endif #endif