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

rustdoc-search: use smart binary search in bitmaps #133185

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

notriddle
Copy link
Contributor

Addresses a comment from jsha's benchmarking, where the contains function showed up in the profiler. This commit pulls it from about 5% of the runtime to about 0.5%.

Before: https://share.firefox.dev/3ANVjon

After: https://share.firefox.dev/3OeM3gk

Addresses a comment from [jsha's benchmarking], where the `contains`
function showed up in the profiler. This commit pulls it from about
5% of the runtime to about 0.5%.

[jsha's benchmarking]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/search.20profiling/near/481868761
@rustbot
Copy link
Collaborator

rustbot commented Nov 18, 2024

r? @fmease

rustbot has assigned @fmease.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Nov 18, 2024
@rustbot
Copy link
Collaborator

rustbot commented Nov 18, 2024

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @jsha

for (let i = 0; i < this.keys.length; ++i) {
if (this.keys[i] === key) {
return this.containers[i].contains(value);
let left = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Please add some code comments to explain the algorithm used and in particular why we don't simply iterate over the items.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I've added some comments.

Copy link
Member

Choose a reason for hiding this comment

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

Much appreciated, thanks!

@notriddle notriddle force-pushed the notriddle/roaringbitmap branch from fda0aee to 826d023 Compare November 18, 2024 20:38
@GuillaumeGomez
Copy link
Member

Thanks! r=me once CI pass.

@notriddle
Copy link
Contributor Author

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 18, 2024

📌 Commit 826d023 has been approved by notriddle

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 18, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 19, 2024
Rollup of 9 pull requests

Successful merges:

 - rust-lang#132758 (Improve `{BTreeMap,HashMap}::get_key_value` docs.)
 - rust-lang#133180 ([rustdoc] Fix items with generics not having their jump to def link generated)
 - rust-lang#133181 (Update books)
 - rust-lang#133182 (const_panic: inline in bootstrap builds to avoid f16/f128 crashes)
 - rust-lang#133185 (rustdoc-search: use smart binary search in bitmaps)
 - rust-lang#133186 (Document s390x-unknown-linux targets)
 - rust-lang#133187 (Add reference annotations for diagnostic attributes)
 - rust-lang#133191 (rustdoc book: Move `--test-builder(--wrapper)?` docs to unstable section.)
 - rust-lang#133192 (RELEASES.md: Don't document unstable `--test-build-wrapper`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5f537c4 into rust-lang:master Nov 19, 2024
6 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Nov 19, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 19, 2024
Rollup merge of rust-lang#133185 - notriddle:notriddle/roaringbitmap, r=notriddle

rustdoc-search: use smart binary search in bitmaps

Addresses a comment from [jsha's benchmarking], where the `contains` function showed up in the profiler. This commit pulls it from about 5% of the runtime to about 0.5%.

Before: https://share.firefox.dev/3ANVjon

After: https://share.firefox.dev/3OeM3gk

[jsha's benchmarking]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/search.20profiling/near/481868761
@notriddle notriddle deleted the notriddle/roaringbitmap branch November 19, 2024 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants