]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-121267: Improve performance of tarfile (#121267) (#121269)
authorJohan Förberg <johan@forberg.se>
Wed, 30 Oct 2024 22:08:30 +0000 (23:08 +0100)
committerGitHub <noreply@github.com>
Wed, 30 Oct 2024 22:08:30 +0000 (15:08 -0700)
commit2b2d607095335024e5e2bb358e3ef37650536839
tree5ba62564ad109b7c3eaab265e15f6e2a6a57ddca
parent616468b87bc5bcf5a4db688637ef748e1243db8a
gh-121267: Improve performance of tarfile (#121267) (#121269)

Tarfile in the default write mode spends much of its time resolving UIDs
into usernames and GIDs into group names. By caching these mappings, a
significant speedup can be achieved.

In my simple benchmark[1], this extra caching speeds up tarfile by 8x.

[1] https://gist.github.com/jforberg/86af759c796199740c31547ae828aef2

---------

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Lib/tarfile.py
Misc/NEWS.d/next/Library/2024-07-02-15-56-42.gh-issue-121267.yFBWkh.rst [new file with mode: 0644]