-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the tests run faster #4808
Conversation
cfbd077
to
d1aed82
Compare
…unning in release mode
…when it's not required
2eb34df
to
9372c34
Compare
|
||
/// add_documents is not allowed on shared index but we need to use it to initialize | ||
/// a bunch of very common indexes in `common/mod.rs`. | ||
pub(super) async fn _add_documents( |
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.
this is test code so I don't really mind, but for the record I'm not a fan of having underscore functions here.
underscore has the specific meaning of "maybe unused" in Rust, so if these are internal functions I would either have made them free functions of the module, or if self contains a lot of data, I would have made an internal index object exposing the functions
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.
With the pub(super)
honestly, it could simply be in the module, and without the _
.
I’m merging as-is because the PR is already huge, but if you want, I can do either:
- Remove the
_
and let the method in the module - Free functions of the module
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.
thanks!
bors merge |
Index-Scheduler
Only check the consistency of the index-scheduler on snapshots when running in release mode
This saves 12s on the tests, and since the tests run in release mode in the CI, we don't lose any information.
From 28s to 16s
We were snapshotting the index for no reason in
advance_till
, I removed this callThis saved an additional 8s on the tests, going from 16s to 8s.
After these two optimizations, the test suite as a whole executes 14% quicker
Meilisearch integration tests
While profiling this test suite, nothing stands out. The only noticeable thing is that we're losing most of our time creating and dropping threads.
I made the theory that by sharing a single common instance between all integrations tests I would gain some time again.
In 355a7ac I saved another 15s by only testing this theory on the module that tests the error messages.
But we can do it on many more tests. We must take care of not making any test flaky, though.
Use two indexing threads
By moving from one to two indexing threads, we gain an additional 30% in performance.
Conclusion
Before
The execution of the test suite was taking around:
After
The execution of the test suite is taking around:
This means the test suite should now run ~50% faster on your computer; the CI may report errors twice faster, but we'll still wait for ~the same amount of time to merge a PR