JohnDoee / autotorrent2

Cross-seed matching and torrent lifecycle tool
https://johndoee.github.io/autotorrent2/
MIT License
142 stars 10 forks source link

Use os.scandir to reduce number of syscalls #45

Closed kannibalox closed 5 months ago

kannibalox commented 1 year ago

True to the PEP, this reduces the number of syscalls by roughly 1/3 on Linux.

I used strace -f at2 scan|& grep <scanned path> | wc -l to count the number of syscalls for a directory with 18155 files and 2101 directories (20256 entries total). On master, 58666 syscalls were issued, and with this change the new count is exactly 20256.

It can be merged completely independently of #41