Skip to content

Microoptimise read buffering, metastore abspath, path joining - #20810

Merged
hauntsaninja merged 1 commit into
python:masterfrom
hauntsaninja:microopt
Feb 15, 2026
Merged

hauntsaninja merged 1 commit into
python:masterfrom
hauntsaninja:microopt

Conversation

@hauntsaninja

Copy link
Copy Markdown
Collaborator

Removing buffering on file reads can make those reads like 20% faster. This is probably worth a few percent on a warm cache profile I was looking at.

Removing abspath in metastore also looks like a percent or two on a warm cache profile.

I don't think using the faster path join from #17949 will really help the profiles I was looking at, but if we're microoptimising some of these code paths we might as well. (On a cold profile I do think some of the variadic os.path.join now add up enough that it could be worth making a function for them, but whatever)

Removing buffering on file reads can make those reads like 20% faster.
This is probably worth a few percent on a warm cache profile I was
looking at.

Removing abspath in metastore also looks like a percent or two on a warm
cache profile.

I don't think using the faster path join from python#17949 will really help
the profiles I was looking at, but if we're microoptimising some of
these code paths we might as well. (On a cold profile I do think some
of the variadic os.path.join now add up enough that it could be worth
making a function for them, but whatever)
@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@hauntsaninja
hauntsaninja merged commit a86f7e3 into python:master Feb 15, 2026
24 checks passed
@hauntsaninja
hauntsaninja deleted the microopt branch February 15, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants