milli
milli copied to clipboard
Speed up debug builds
Note: this draft PR is based on https://github.com/meilisearch/milli/pull/601 , for no particular reason.
What does this PR do?
Make a series of changes with the goal of speeding up debug builds:
- Add an
all_languagesfeature which compiles charabia with itsdefaultfeatures activated. Theall_languagesfeature is activated by default. But running:
cargo build --no-default-features
on milli is now much faster.
-
Reduce the debug optimisation level from 3 to 0, except for a few critical dependencies.
-
Compile the build dependencies quicker as well. Previously, all build dependencies were compiled with
opt-level = 3. Now, only the critical build dependencies are compiled with optimisations. -
Reduce the amount of code generated by the
documents!macro -
Make the "progress update" closure provided to indexing functions a trait object instead of a generic parameter. This avoids monomorphising the indexing code multiple times needlessly.
Results
Initial build times on my computer before and after these changes:
| cargo check | cargo check --no-default-features | cargo test | cargo test --lib | cargo test --no-default-features | cargo test --lib --no-default-features | |
|---|---|---|---|---|---|---|
| before | 1m05s | 1m05s | 2m06s | 1m47s | 2m06 | 1m47s |
| after | 28.9s | 13.1s | 40s | 38s | 23s | 21s |
lets retry, bors merge
This is an issue with Cargo and the crates index. bors merge
Merge conflict.
I rebased it on top of main, let's try again haha
bors merge
Build failed:
- Tests on windows-latest
Nice!
LLVM ERROR: IO failure on output stream: no space on device
error: could not compile `lindera-ipadic`
bors merge
haha! @irevoire it's your turn to try afterwards!
@loiclec Is this PR making the library bigger or what? 😂
I was starting to wonder as well. Since it is compiled with opt-level = 0, the binary will be bigger indeed :/ I'll check on my computer if it seems excessive or not.
On my computer (macOS, so not necessarily the same), there doesn't seem to be any significant difference between the size of the target/ folder before and after the PR. So I am still confused as to why it fails :(
Let's hope the CI was just having a bad day?
bors merge pretty please 🥺🙏
Merge conflict.
nooooo 😭 I guess there really is something about that PR that makes rustc on Windows sad
but it worked here 🤔

I've rebased the branch on main so it's ready to merge again :-)
Hey @loiclec, could it be possible to deactivate the default features of Charabia when it is compiled in debug? Most of the time, we don't need to have full language support activated during the development phase.
This message is sent automatically
Thank you for contributing to Meilisearch. If you are participating in Hacktoberfest, and you would like to receive some gift from Meilisearch too, please complete this form.