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

blake2 code size very high (overuse of#[inline(always)]?) #322

Open
thomcc opened this issue Oct 7, 2021 · 1 comment
Open

blake2 code size very high (overuse of#[inline(always)]?) #322

thomcc opened this issue Oct 7, 2021 · 1 comment

Comments

@thomcc
Copy link

thomcc commented Oct 7, 2021

I have ~150kb of code for blake2::blake2b::VarBlake2b::compress under -Copt-level=z, which is around 3x larger than any other function in my binary. It would be nice if it were smaller.

Looking at https://github.com/RustCrypto/hashes/blob/master/blake2/src/blake2.rs, a lot is #[inline(always)], and the round calls are manually unrolled.

There's a good chance these would still get inlined and unrolled on -Copt-level=3 if it were written using #[inline] and a loop, but it would make a big difference to use cases where large code is undesirable.

@thomcc thomcc changed the title blake2 code size very high (overuse of#[inline(alway)] blake2 code size very high (overuse of#[inline(alway)]s?) Oct 7, 2021
@thomcc thomcc changed the title blake2 code size very high (overuse of#[inline(alway)]s?) blake2 code size very high (overuse of#[inline(always)]?) Oct 7, 2021
@tarcieri
Copy link
Member

tarcieri commented Oct 7, 2021

Note that there's an open PR to completely replace the current implementation: #228

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

No branches or pull requests

2 participants