os.DirEntry.is_junction
can be ~twice as fast
#108717
Labels
os.DirEntry.is_junction
can be ~twice as fast
#108717
Uh oh!
There was an error while loading. Please reload this page.
Right now it is implemented as:
cpython/Modules/posixmodule.c
Lines 14566 to 14583 in 79823c1
Removing unused
defining_class: defining_class
from clinic has one big adavantage (aside from the fact that it is unused in the first place): it speeds upis_junction
call.The exact benchmark is system-dependent, here are my numbers (note, that I am on macos and always get
False
as the result).Setup:
./configure --with-pydebug && make -j
pyperf
pyperf timeit --setup 'import os; d = os.scandir("."); d1 = next(d); d.close()' 'd1.is_junction()'
With
defining_class
:Without:
This happens because
is_junction
def is changed fromMETH_METHOD|METH_FASTCALL|METH_KEYWORDS
toMETH_NOARGS
.I have a PR ready.
Linked PRs
os.DirEntry.is_junction
function #108718The text was updated successfully, but these errors were encountered: