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

Code size reduction from panic reduction #145

Merged
merged 5 commits into from
Jan 28, 2024

Conversation

kornelski
Copy link
Contributor

Manual bounds checks optimize better, because they don't have additional side effects, and don't need to set a unique panic location each time.

input = &input[in_consumed..] optimizes better than advancing in_pos.

There's a ton more panics in decompress.

@oyvindln
Copy link
Collaborator

Thanks, any measurements?

I've not really done much work on this being busy with other projects for the last few years and @Frommi has been nowhere to be seen so there's probably a lot of room for optimization and improvement with updates to Rust in the meantime.

@oyvindln oyvindln merged commit 201ef39 into Frommi:master Jan 28, 2024
8 checks passed
@kornelski
Copy link
Contributor Author

I'm using cargo-show-asm to verify, and for example init_tree has 20% fewer instructions.

@kornelski kornelski deleted the fewer-panics branch January 28, 2024 21:16
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