[issue11258] ctypes: Speed up find_library() on Linux by 500%
Antoine Pitrou
report at bugs.python.org
Sun Feb 27 16:00:46 CET 2011
Antoine Pitrou <pitrou at free.fr> added the comment:
Here is an excerpt:
libc.so.6 (libc6,x86-64, OS ABI: Linux 2.6.9) => /lib64/libc.so.6
libc.so.6 (libc6, OS ABI: Linux 2.6.9) => /lib/libc.so.6
The "OS ABI" thing is not always there:
libdrm.so.2 (libc6,x86-64) => /usr/lib64/libdrm.so.2
libdrm.so.2 (libc6) => /usr/lib/libdrm.so.2
As you see, there are two of them with the same name but in a different path. If you return the absolute path, there is a 50% possibility that you are returning the wrong one ;)
There seem to be two key differences between the original implementation and yours:
- the orig impl matches the abi_type at the beginning of the parentheses, yours simply ignores the abi_type (that should have caught my eye, but that regex looked so much like magic that I didn't try to make sense of it :-))
- the orig impl returns the file name from the beginning of the matched line, yours returns the full path from the end of the line
I guess it should be doable to retain the speed benefit while implementing a matching algorithm closer to the original one.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11258>
_______________________________________
More information about the Python-bugs-list
mailing list