-
Notifications
You must be signed in to change notification settings - Fork 81
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is pretty amazing the amount of lines of code that you removed by defining new helping methods on the TestIndex
struct 🎉
Thank you very much for introducing insta.rs in milli, it looks amazing, I am impatient to learn more about it!
a95122d
to
6f49126
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That’s super noice, can’t wait to use it!
Does anybody know why the tests are failing on Windows? 🤔 |
I have no clue. It looks like it is failing to infer types but ONLY on windows? Is it due to the new version of Rust? I reran it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thank you very much!
bors merge
Build succeeded: |
604: Speed up debug builds r=Kerollmops a=loiclec Note: this draft PR is based on #601 , for no particular reason. ## What does this PR do? Make a series of changes with the goal of speeding up debug builds: 1. Add an `all_languages` feature which compiles charabia with its `default` features activated. The `all_languages` feature is activated by default. But running: ``` cargo build --no-default-features ``` on `milli` is now much faster. 2. Reduce the debug optimisation level from 3 to 0, except for a few critical dependencies. 3. 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. 4. Reduce the amount of code generated by the `documents!` macro 5. 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 | Co-authored-by: Loïc Lecrenier <loic@meilisearch.com> Co-authored-by: Loïc Lecrenier <loic.lecrenier@me.com>
604: Speed up debug builds r=ManyTheFish a=loiclec Note: this draft PR is based on #601 , for no particular reason. ## What does this PR do? Make a series of changes with the goal of speeding up debug builds: 1. Add an `all_languages` feature which compiles charabia with its `default` features activated. The `all_languages` feature is activated by default. But running: ``` cargo build --no-default-features ``` on `milli` is now much faster. 2. Reduce the debug optimisation level from 3 to 0, except for a few critical dependencies. 3. 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. 4. Reduce the amount of code generated by the `documents!` macro 5. 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 | Co-authored-by: Loïc Lecrenier <loic@meilisearch.com> Co-authored-by: Loïc Lecrenier <loic.lecrenier@me.com>
604: Speed up debug builds r=loiclec a=loiclec Note: this draft PR is based on #601 , for no particular reason. ## What does this PR do? Make a series of changes with the goal of speeding up debug builds: 1. Add an `all_languages` feature which compiles charabia with its `default` features activated. The `all_languages` feature is activated by default. But running: ``` cargo build --no-default-features ``` on `milli` is now much faster. 2. Reduce the debug optimisation level from 3 to 0, except for a few critical dependencies. 3. 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. 4. Reduce the amount of code generated by the `documents!` macro 5. 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 | Co-authored-by: Loïc Lecrenier <loic@meilisearch.com> Co-authored-by: Loïc Lecrenier <loic.lecrenier@me.com>
604: Speed up debug builds r=Kerollmops a=loiclec Note: this draft PR is based on #601 , for no particular reason. ## What does this PR do? Make a series of changes with the goal of speeding up debug builds: 1. Add an `all_languages` feature which compiles charabia with its `default` features activated. The `all_languages` feature is activated by default. But running: ``` cargo build --no-default-features ``` on `milli` is now much faster. 2. Reduce the debug optimisation level from 3 to 0, except for a few critical dependencies. 3. 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. 4. Reduce the amount of code generated by the `documents!` macro 5. 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 | Co-authored-by: Loïc Lecrenier <loic@meilisearch.com> Co-authored-by: Loïc Lecrenier <loic.lecrenier@me.com>
604: Speed up debug builds r=irevoire a=loiclec Note: this draft PR is based on #601 , for no particular reason. ## What does this PR do? Make a series of changes with the goal of speeding up debug builds: 1. Add an `all_languages` feature which compiles charabia with its `default` features activated. The `all_languages` feature is activated by default. But running: ``` cargo build --no-default-features ``` on `milli` is now much faster. 2. Reduce the debug optimisation level from 3 to 0, except for a few critical dependencies. 3. 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. 4. Reduce the amount of code generated by the `documents!` macro 5. 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 | Co-authored-by: Loïc Lecrenier <loic@meilisearch.com> Co-authored-by: Loïc Lecrenier <loic.lecrenier@me.com>
604: Speed up debug builds r=Kerollmops a=loiclec Note: this draft PR is based on #601 , for no particular reason. ## What does this PR do? Make a series of changes with the goal of speeding up debug builds: 1. Add an `all_languages` feature which compiles charabia with its `default` features activated. The `all_languages` feature is activated by default. But running: ``` cargo build --no-default-features ``` on `milli` is now much faster. 2. Reduce the debug optimisation level from 3 to 0, except for a few critical dependencies. 3. 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. 4. Reduce the amount of code generated by the `documents!` macro 5. 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 | Co-authored-by: Loïc Lecrenier <loic@meilisearch.com>
Pull Request
What does this PR do?
Introduce snapshot tests into milli, by using the
insta
crate. This implements the idea described by meilisearch/meilisearch#3360See: insta.rs
Design
There is now a new file,
snapshot_tests.rs
, which is compiled only under#[cfg(test)]
. It exposes thedb_snap!
macro, which is used to snapshot the content of a database.When running
cargo test
,insta
will check that the value of the current snapshot is the same as the previous one (on the file system). If they are the same, the test passes. If they are different, the test fails and you are asked to review the new snapshot to approve or reject it.We don't want to save very large snapshots to the file system, because it will pollute the git repository and increase its size too much. Instead, we only save their
md5
hashes under the name<snapshot_name>.hash.snap
. There is a new environment variable calledMILLI_TEST_FULL_SNAPS
which can be set totrue
in order to also save the full content of the snapshot under the name<snapshot_name>.full.snap
. However, snapshots with the extension.full.snap
are never saved to the git repository.Example