Improve build time by turning off regex cargo features #6
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.
Note: I realized after I finished that this PR will increase the minimum required Rust version to that of regex 1.3.1, which is 1.28.0. This is probably not acceptable at this time. But thought it better to send the PR anyway, for reference.
The first commit adds a benchmark example in order to measure the impact of the second commit.
Second commit:
Only enable the regex features we need. See here for reference:
https://docs.rs/regex/1.3.1/regex/#crate-features
This reduces compilation time in release mode on my computer from ~30s
to ~16s (~50% decrease).
This increases the benchmark runtime on my computer in release mode with
-C target-cpu=native
from ~0.5s to ~0.65s (~%30 increase).chrono-tz uses this crate at build time to parse a few files, in which
case runtime speed is not super important, while compilation speed is.
If a crate does require maximum speed, it can enable regex's
perf
feature in its own Cargo.toml.