Skip to content
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

Merged
merged 15 commits into from
Jul 30, 2024
Merged

Make the tests run faster #4808

merged 15 commits into from
Jul 30, 2024

Conversation

irevoire
Copy link
Member

@irevoire irevoire commented Jul 18, 2024

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 call

This 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:

  • 4m40s on my computer
  • 15 minutes on the debug CI with cache
  • 29 minutes on the Windows CI with cache

After

The execution of the test suite is taking around:

  • 2m20 on my computer
  • 8 minutes on the debug CI with cache
  • 29 minutes on the Windows CI with cache

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

@irevoire irevoire force-pushed the make-the-tests-run-faster branch 2 times, most recently from cfbd077 to d1aed82 Compare July 18, 2024 14:58
@irevoire irevoire marked this pull request as ready for review July 18, 2024 16:28
@irevoire irevoire added this to the v1.10.0 milestone Jul 18, 2024
@irevoire irevoire added the maintenance Issue about maintenance (CI, tests, refacto...) label Jul 18, 2024
@irevoire irevoire requested a review from a team July 18, 2024 16:33
@curquiza curquiza removed this from the v1.10.0 milestone Jul 30, 2024
@irevoire irevoire added this to the v1.11.0 milestone Jul 30, 2024

/// 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(
Copy link
Contributor

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

Copy link
Member Author

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

Copy link
Contributor

@dureuill dureuill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@irevoire
Copy link
Member Author

bors merge

Copy link
Contributor

meili-bors bot commented Jul 30, 2024

@irevoire irevoire merged commit 866922e into main Jul 30, 2024
10 checks passed
@irevoire irevoire deleted the make-the-tests-run-faster branch July 30, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Issue about maintenance (CI, tests, refacto...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants