Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize reader refill logic #154

Merged
merged 1 commit into from
Jan 15, 2024
Merged

Reorganize reader refill logic #154

merged 1 commit into from
Jan 15, 2024

Conversation

nickbabcock
Copy link
Contributor

Extracting the refill logic into a separate function makes the code less nested without resorting to calls that risk a stack overflow.

Changing the binary reader inner functions to return Result<Option<_>>, instead of two options netted a 5% throughput improvement on EU4 save melting. The two options were originally introduced as their was a large benefit measured. I don't know what happened, perhaps reorganizing the refill logic is a boon.

The text reader internal return types haven't been modified as they still show a 5% improvement over the Result<Option<_>> alternative.

Extracting the refill logic into a separate function makes the code less
nested without resorting to `call`s that risk a stack overflow.

Changing the binary reader inner functions to return
`Result<Option<_>>`, instead of two options netted a 5% throughput
improvement on EU4 save melting. The two options were originally
introduced as their was a large benefit measured. I don't know what
happened, perhaps reorganizing the refill logic is a boon.

The text reader internal return types haven't been modified as they
still show a 5% improvement over the `Result<Option<_>>` alternative.
@nickbabcock nickbabcock merged commit 9d0f43e into master Jan 15, 2024
7 checks passed
@nickbabcock nickbabcock deleted the opt branch January 15, 2024 19:41
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.

1 participant