Repository navigation
Avoid reading each existing POT file twice during extraction - #448
Merged
whatyouhide merged 1 commit intoOct 27, 2026
Merged
Conversation
`read_contents_and_parse/1` read the file with `File.read!/1` and then called `PO.parse_file!/2`, which reads the very same file again internally. Pass the contents we already have to `PO.parse_string!/2` instead. `PO.parse_file!(path, file: path)` is defined as `File.read` followed by `parse_string(contents, file: path)`, so the parsed result is identical; the existing `File.read!/1` still raises on a missing file. This removes one disk read per existing POT file on every `mix gettext.extract`.
josevalim
approved these changes
Oct 26, 2026
Contributor
|
Nice thank you @oliver-kriska 🫶 |
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.
Avoid a second disk read of each existing POT file during extraction by parsing the contents already read by
File.read!/1.Expo.PO.parse_file!/2delegates to the same string parser after reading the file; preservingfile: pathretains filename metadata and error attribution.Split from #445 as requested, based directly on the latest upstream
main. This is independent of the plural-info and interpolation-cache changes. It removes one read per POT file, not a second parse; no meaningful end-to-end speedup is claimed.Verified with compilation using
--warnings-as-errors, formatting, and the existing full suite: 193 checks (188 tests and 5 doctests) pass on Elixir 1.20.4/OTP 29 and 1.18.4/OTP 27. The three split changes also combine without conflicts and pass the full suite together. The earlier real-catalog validation remains documented in #445; it was not rerun for this split.