-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
83: Use Vec::retain instead of Vec::remove r=Kerollmops a=Kerollmops There are many places where we use [the `Vec::remove` method](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.remove). It can bring a lot of performances issues as every time this function is called, the right part of the Vec (after the removed element) is shifted to the left by one, when a lot of element must be removed, we should always use [`Vec::retain`](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.retain) which is more optimized for this in the sense that it will avoid calling a lot the copy function for when multiple elements must be removed at the same time. I found that doing this change in the `Store::intersect_with` method for the Array-Array operation gave me much better performances (7m intersected with 3m and intersected with 4m again), moving from 240ms to 55ms. I am sure that we can optimize the current implementation more. - [x] Stores intersections. - [x] Stores differences. - [ ] Stores symmetric differences. Co-authored-by: Clément Renault <[email protected]> Co-authored-by: Kerollmops <[email protected]>
- Loading branch information
Showing
3 changed files
with
22 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters