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

0.9.0 Tracking Issue #178

Open
16 tasks done
saik0 opened this issue Feb 5, 2022 · 13 comments
Open
16 tasks done

0.9.0 Tracking Issue #178

saik0 opened this issue Feb 5, 2022 · 13 comments

Comments

@saik0
Copy link
Contributor

saik0 commented Feb 5, 2022

Here's what I think is still left before next release

Release notes

  • Breaking changes

    • Removed deprecated set ops such as union_with. Use the corresponding operators |=.
    • MSRV increased to 1.56
    • deserialize_from validates inputs. It some cases it can be 4x slower. For workloads that are heavy in deserialization from trusted sources migrate to deserialize_unchecked_from
  • Performance optimizations

    • from_sorted_iter and append are exponentially faster. They should be preferred over collect and extend whenever adding monotonically increasing integers to the set as it's about 2-2.5x faster.
    • Other performance optimizations.
      Min Mean Max
      Iteration 6% 57% 125%
      And 0% 7% 22%
      Or 0% 10% 33%
      Sub 0% 9% 39%
      Xor 4% 90% 209%
  • New features

    • rank Returns the number of integers that are <= value. rank(u64::MAX) == len()
    • select Returns the nth integer in the set or None if n <= len()
    • union_len intersection_len ... and so on. Compute the cardinality of a set operation without materializing it. Usually about twice as fast as materializing the bitmap.
    • implemented DoubleEndedIterator
    • implemented ExactSizeIterator (on 64 bit targets only)
    • EXPERIMENTAL SIMD feature (requires rust nightly)
      Min Mean Max
      And 0% 34% 141%
      Or 2% 45% 145%
      Sub 0% 51% 168%
      Xor 0% 130% 437%
  • Other

    • Added property testing suite for set operations
    • Added many benchmarks and real world datasets

Perf numbers are for pairwise operations on collections of bitmaps from real datasets.
Pairwise as in: B1 ∩ B2, B2 ∩ B3, ... BN-1 ∩ BN

@saik0
Copy link
Contributor Author

saik0 commented Feb 9, 2022

@Kerollmops

Thinking out loud: A major version bump would be a good time to bump rust edition to 2021

Edit: Plus, we've already bumped MSRV to min supported ver for 2021 edition

@saik0
Copy link
Contributor Author

saik0 commented Feb 10, 2022

Here are my benchmark comparisons for v0.8.1 to 49455d4

Environment

Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz. Hyperthreading and frequency scaling disabled. Base Arch Linux install. Linux 5.16.5-arch1-1

Analysis

On rust stable (scalar only)

The good

  1. from_sorted_iter and append are exponentially faster
  2. iteration can be as much as 125% faster [1]
  3. Perf improved for all set ops [1]
    • intersection can be as much as 22% faster
    • union can be as much as 33% faster
    • difference can be as much as 40% faster
    • symmetric difference can be as much as 50% faster

[1] Depends on the dataset. Can be as little as zero

The bad

  1. deserialize_into is between 60-400% slower with data validation. We are planning on calling this out.
  2. container::len used to be field access, now it must branch on store type. This is a tradeoff we made to make cardinality tracking while flipping bits on bitmaps, which is part of why all the set ops are faster. However it has led to had some unintended downstream effects.
    • RoaringBitmap::len is slower by about 60%.
    • RoaringBitmap::serialize_into is about 10-20% slower
    • Absolute difference for both of the above is on the order of tens of micros per dataset of 200 bitmaps each. I think this is a great trade off given the wins for set ops can be measured in millis and are much more likely to be on hot code paths than serializing for most use cases.

Data

critcmp.zip

Notes

  • Difference between old deserialize_into and new deserialize_into_unvalidated is within noise threshold. This is not absent from the data, as previously there was no deserialize_into_unvalidated benchmarks that could be compared automatically. I had to validate this manually.

  • is_disjoint being ~15% slower appears to have just been noise. I wasn't able to reproduce this over multiple runs

Analysis for SIMD coming later, but the data is in the zip if you want to peek

@saik0
Copy link
Contributor Author

saik0 commented Feb 11, 2022

SIMD

  • intersection can be as much as 140% faster
  • union can be as much as 145% faster
  • difference can be as much as 168% faster
  • symmetric difference can be as much as 437% faster. mostly because Scalar in place xor has poor performance #191

@saik0
Copy link
Contributor Author

saik0 commented Feb 11, 2022

@Kerollmops Time to get rid of union_with() (and others) deprecated in 0.6.7? (April 2021)

@Kerollmops
Copy link
Member

Kerollmops commented Feb 11, 2022

Time to get rid of union_with() (and others) deprecated in 0.6.7? (April 2021)

You are right, I created issue #200 about that thank you for the reminder.

Here are my benchmark comparisons for v0.8.1 to 49455d4

I am so much impressed by what you've done and it is only the benchmarks for x64_86 🎉

About the scalar version, you are right: the perf losses aren't much important as they are under the millisecond!
About the SIMD version, that's impressive too! I was sure your work would break the law of physics 🚄 🚀

Once we release the new version of roaring I will create a GitHub release to talk about the work you have done, featuring Meilisearch just for its fame and the indirect help you bring to this project. We are so much awaiting this release of Roaring on the Meilisearch side, just to see those flamegraphs melt 🧊

Meilisearch and other projects intensively using roaring would also gain speed by using the new multi-ops API, however, it can be released in a future version as it will not be breaking!

@saik0
Copy link
Contributor Author

saik0 commented Feb 11, 2022

I am so much impressed by what you've done and it is only the benchmarks for x64_86 🎉

Thanks. I'm curious to see how the array_array SIMD does on other platforms

We are so much awaiting this release of Roaring on the Meilisearch side, just to see those flamegraphs melt

😂

I'm pleased to contribute to OSS again, it's been too long.

Meilisearch and other projects intensively using roaring would also gain speed by using the new multi-ops API, however, it can be released in a future version as it will not be breaking!

That reminds me. I'm going to create a planning ticket for next_version++

@saik0
Copy link
Contributor Author

saik0 commented Feb 11, 2022

@Kerollmops
I kicked out #204. It can wait.

Do you think I should try to do a quick fix for #191 since the theme of this release is: 🚀

@saik0 saik0 changed the title Version bump checklist 0.9.0 Tracking Issue Feb 11, 2022
@Kerollmops
Copy link
Member

Kerollmops commented Feb 11, 2022

Do you think I should try to do a quick fix for #191 since the theme of this release is: 🚀

You can indeed if you have already a good idea of how you would speed this up!

@saik0
Copy link
Contributor Author

saik0 commented Feb 11, 2022

You can indeed if you have already a good idea of how you would speed this up!

Just get rid of the in place operation and force an allocation like we have with union.

@saik0
Copy link
Contributor Author

saik0 commented Feb 11, 2022

@Kerollmops Release notes contains perf from unmerged xor change. AFAICT master is ready to ship as 0.9 once merged

@saik0
Copy link
Contributor Author

saik0 commented Feb 24, 2022

@Kerollmops Updated release notes for #187. Are we ready to bump the version and release?

@Kerollmops
Copy link
Member

Yeah, I think we are ready to do so now. You are right that even if there are no breaking changes we should bump the version as we drastically impacted the performances of deserialize_from. I will do this either today or tomorrow.

Thank you for reminding me!

bors bot added a commit that referenced this issue Feb 25, 2022
215: Bump the version to 0.9.0 r=Kerollmops a=Kerollmops

The release notes are available in #178 and will be added to the GitHub release, thank you `@saik0` for the notes again!

Co-authored-by: Kerollmops <[email protected]>
@Kerollmops
Copy link
Member

Hum... @saik0,

I have a small issue when I try to publish the crate on crates.io: it seems that we can't publish a crate that depends on a git repository and that this dependency doesn't define the version of that crate that has been published to crates.io.

However, core_simd, doesn't seem to be available on crates.io.

$ cargo publish --dry-run
Updating crates.io index
error: all dependencies must have a version specified when publishing.
dependency `core_simd` does not specify a version
Note: The published dependency will use the version from crates.io,
the `git` specification will be removed from the dependency declaration.

not-jan pushed a commit to not-jan/roaring-rs that referenced this issue Aug 31, 2022
215: Bump the version to 0.9.0 r=Kerollmops a=Kerollmops

The release notes are available in RoaringBitmap#178 and will be added to the GitHub release, thank you `@saik0` for the notes again!

Co-authored-by: Kerollmops <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants