blocks: split macro into multiple functions, fast! #267
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.
Improves fix for #184, whereas #255 reduced optimizations,
we now address the underlying compiler limitation and split out
the one massive lazy_static! initialization function, into
one function per block in the block_registration_functions module.
Previous build time, with opt-level=1:
% time cargo build --release
Compiling steven_blocks v0.0.1
Finished release [optimized] target(s) in 21.24s
cargo build --release 31.80s user 0.71s system 152% cpu 21.276 total
With this change, opt-level=3 and the function splitting fix:
% time cargo build --release
Compiling steven_blocks v0.0.1
Finished release [optimized] target(s) in 30.80s
cargo build --release 40.26s user 0.86s system 133% cpu 30.850 total
Full optimizations are expectedly slightly slower, but this is still
much much much faster than before this refactoring, where this crate
would take up to an unbelievable 5 hours (and tens of GB of RAM). Long
story short, we're now back to full optimizations and stable Rust.