[Python-Dev] Importing .pyc in -O mode and vice versa

"Martin v. Löwis" martin at v.loewis.de
Sun Nov 5 21:36:51 CET 2006

Aahz schrieb:
> Maybe so, but I recently dealt with a painful bottleneck in Python code
> caused by excessive stat() calls on a directory with thousands of files,
> while the os.listdir() function was bogging things down hardly at all.
> Granted, Python bytecode was almost certainly the cause of much of the
> overhead, but I still suspect that a simple listing will be faster in C
> code because of fewer system calls.  It should be a matter of profiling
> before this suggestion is rejected rather than making assertions about
> what "should" be happening.

That works both ways, of course: whoever implements such a patch should
also provide profiling information.

Last time I changed the importing code to reduce the number of stat
calls, I could hardly demonstrate a speedup.


More information about the Python-Dev mailing list