The implementation uses some inline(always) to force inline the round and quarter_round functions for performance. This PR adds an opt-in Cargo feature to disable them, to allow optimizing for size instead.
Building for thumbv6m-none-eabi:
size_opt disabled: 5772 bytes
size_opt enabled: 2372 bytes
This saves 3.4kb of code size, which is 60%.
I'm trying to use blake2 on a microcontroller with 32kb of Flash memory (where the code is stored), so saving 3.4kb is quite substantial.
The implementation uses some
inline(always)
to force inline theround
andquarter_round
functions for performance. This PR adds an opt-in Cargo feature to disable them, to allow optimizing for size instead.Building for
thumbv6m-none-eabi
:size_opt
disabled: 5772 bytessize_opt
enabled: 2372 bytesThis saves 3.4kb of code size, which is 60%.
I'm trying to use blake2 on a microcontroller with 32kb of Flash memory (where the code is stored), so saving 3.4kb is quite substantial.