Merged
Conversation
✅ Deploy Preview for salsa-rs canceled.
|
MichaReiser
commented
Nov 17, 2024
src/accumulator/accumulated_map.rs
Outdated
| } | ||
|
|
||
| /// Marks the accumulator result that some nested query has some accumulated values. | ||
| pub fn add_dependency_with_accumulated_values(&mut self) { |
Contributor
Author
There was a problem hiding this comment.
I don't like the naming at all but struggled to come up with something better.
CodSpeed Performance ReportMerging #615 will not alter performanceComparing Summary
Benchmarks breakdown
|
davidbarsky
approved these changes
Nov 18, 2024
Contributor
davidbarsky
left a comment
There was a problem hiding this comment.
approving modulo one nit. I'll let you decide whether to merge or not.
60fdbc8 to
a43468c
Compare
a43468c to
76079d2
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements faster accumulators.
Accumulators are relatively costly today because collecting the accumulated values requires iterating over the queries' entire dependency tree.
This cost is negligible with a cold DB but adds up for very deep trees.
For example, adding accumulators to Ruff resulted in a 30% perf regression astral-sh/ruff#14116
This PR adds a new field to
AccumulatedMapthat tracks whether any dependency of the current query has any accumulated values. It checks that field when collecting the accumulated values, allowing it to skip entire subtrees.This approach should make accumulated values nearly "free" in the common cases where there are no or only very few diagnostics.
Test Plan
I added a benchmark and I verified that the perf regression in the linked Ruff PR is mostly gone after using this salsa version.
Running the benchmark locally gives me
where the baseline is main