cpython
cpython copied to clipboard
gh-121109: Fix performance of tarfile reading with "r|*"
This PR fixes #121109.
Using the test files and test script described in the issue:
| filename | mode | time with PR |
|---|---|---|
test.tar.gz |
r:* |
1.075s |
test.tar.gz |
r|* |
0.812s |
test.tar.xz |
r:* |
1.066s |
test.tar.xz |
r|* |
1.053s |
test.tar.bz2 |
r:* |
0.913s |
test.tar.bz2 |
r|* |
0.896s |
After this PR, tf.list() of r|* is the same speed as r:*, as expected. Not orders of magnitude slower.
- Issue: gh-121109