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

Approximate sizes of stack and visisted when collecting accumulated values #622

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

MichaReiser
Copy link
Contributor

@MichaReiser MichaReiser commented Dec 4, 2024

This PR uses the input-output length to approximate the number of items added to stack and reserves stack.len() additional items in visited to avoid costly resizes. This reduces the performance regression in astral-sh/ruff#14760 from 10.3% to 9%, which seems worthwhile.

The downside is that it can result in a too large stack if a query has many outputs but only few outputs or in a too large visited set if many inputs are overlapping. I think this is acceptable, considering that the data structures are short-lived.

Performance

This shows a 9% performance improvement for the accumulator benchmark.

Copy link

netlify bot commented Dec 4, 2024

Deploy Preview for salsa-rs canceled.

Name Link
🔨 Latest commit 5314d4c
🔍 Latest deploy log https://app.netlify.com/sites/salsa-rs/deploys/67502214ff59100008541079

Copy link

codspeed-hq bot commented Dec 4, 2024

CodSpeed Performance Report

Merging #622 will not alter performance

Comparing MichaReiser:small-accumulator-perf (5314d4c) with master (e68679b)

Summary

✅ 9 untouched benchmarks

@MichaReiser MichaReiser force-pushed the small-accumulator-perf branch from 64620e7 to 4f365da Compare December 4, 2024 09:17
src/function/accumulated.rs Outdated Show resolved Hide resolved
@MichaReiser MichaReiser force-pushed the small-accumulator-perf branch from 4f365da to 5314d4c Compare December 4, 2024 09:34
@MichaReiser MichaReiser added this pull request to the merge queue Dec 6, 2024
Merged via the queue into salsa-rs:master with commit c2a6d62 Dec 6, 2024
10 checks passed
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

Successfully merging this pull request may close these issues.

3 participants