Minor changes to improve compilation speed #137
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.
This crate is small and compiles quickly, but it's also used everywhere, so trying to improve the compilation speed is worth it.
This PR has a number of optimizations; each commit is independent, so feel free to cherry-pick and take whichever changes you want. This PR preserves the current MSRV of 1.13.
Changes:
rust-version = "1.13"
to theCargo.toml
, to partially document the current MSRVAsRef<Path>
to just take&Path
debug!
macro generate no code when not in useVec
instead of aHashMap
when counting physical cores; using theHashMap
requires compiling a lot more code. (TheVec
should also be faster.)My non-scientific benchmarks of a clean build of the library (
libc
+num_cpus
)Measuring the amount of code passed to LLVM, using cargo-llvm-lines:
cargo llvm-lines --lib -p num_cpus
(with--release
for release builds)