|
@JelleZijlstra I can't assign a reviewer but you merged the prior PR related to os.walk so I decided that it makes sense to ping you here. I hope that's ok :)) |
Sorry, something went wrong.
|
Do you have a benchmark that shows this actually makes it faster? We lose a tuple allocation but gain a function call, so it's not completely obvious this should be faster. |
Sorry, something went wrong.
|
I made this MR because my initial benchmarking with pathlib.Path.walk and os.walk was quite obvious. However, after timing it a few more times I have gotten inconsistent results. Seems like the isinstance version is just a tiny bit (insignificantly) faster but I would still argue that it makes more sense than the original because it is slightly simpler. But what do you think? |
Sorry, something went wrong.
|
Thanks, seems like it's about a wash but since the new code is simpler and we never released the old version, seems fine to change this. |
Sorry, something went wrong.
Use isinstance for checking the top of the stack in os.walk to simplify it and speed it up.
A small benchmark below. "." is this repository.