3 ms·
A simple "if file exists" check shouldn't take 1ms on average. OSes cache directory entries for a reason. I mean, even Python manages 40,000 checks / second:
by TheLoneWolfling 12y ago
A simple "if file exists" check shouldn't take 1ms on average.
OSes cache directory entries for a reason.
I mean, even Python manages 40,000 checks / second:
>>> timeit.timeit("os.path.exists(data)", setup="import os; import random; import string; data = os.path.join(r'C:\Windows\System32', ''.join(random.choice(string.ascii_letters) for _ in range(10)))", number=40000)
0.9998181355403517