]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-129005: Align FileIO.readall() allocation (#129458)
authorCody Maloney <cmaloney@users.noreply.github.com>
Thu, 30 Jan 2025 11:14:23 +0000 (03:14 -0800)
committerGitHub <noreply@github.com>
Thu, 30 Jan 2025 11:14:23 +0000 (11:14 +0000)
commitf927204f64b3f8dbecec784e05bc8e25d2a78b2e
tree3efe8d458ac0129cd7200a00c97ff2fd89557c8b
parent6c63afc3be9dd612f587fe7869c1f317d5ea37cc
gh-129005: Align FileIO.readall() allocation (#129458)

Both now use a pre-allocated buffer of length `bufsize`, fill it using
a readinto(), and have matching "expand buffer" logic.

On my machine this takes:

`./python -m test -M8g -uall test_largefile -m test_large_read -v`

from ~3.7 seconds to ~3.4 seconds.
Lib/_pyio.py
Misc/NEWS.d/next/Library/2025-01-28-21-22-44.gh-issue-129005.h57i9j.rst [new file with mode: 0644]