Microoptimise read buffering, metastore abspath, path joining#20810
Merged
hauntsaninja merged 1 commit intopython:masterfrom Feb 15, 2026
Merged
Microoptimise read buffering, metastore abspath, path joining#20810hauntsaninja merged 1 commit intopython:masterfrom
hauntsaninja merged 1 commit intopython:masterfrom
Conversation
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)
06785b1 to
8016744
Compare
Contributor
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
ilevkivskyi
approved these changes
Feb 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)