Skip to content

[refactor] Reuse the same stack for all cycles heads in validate_same_iteration #791

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

Merged
merged 1 commit into from
Apr 10, 2025

Conversation

MichaReiser
Copy link
Contributor

Retrieve the QueryStack once (including zalsa_local) instead of once for each cycle head

@MichaReiser MichaReiser requested a review from carljm April 10, 2025 06:52
@MichaReiser MichaReiser added the refactoring Code works but is messy label Apr 10, 2025
Copy link

netlify bot commented Apr 10, 2025

Deploy Preview for salsa-rs canceled.

Name Link
🔨 Latest commit e629cc4
🔍 Latest deploy log https://app.netlify.com/sites/salsa-rs/deploys/67f76abde5d90900089fe725

Copy link

codspeed-hq bot commented Apr 10, 2025

CodSpeed Performance Report

Merging #791 will improve performances by 5.59%

Comparing MichaReiser:cycle-heads-reuse-stack (e629cc4) with master (b165ba7)

Summary

⚡ 5 improvements
✅ 7 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
amortized[Input] 3.8 µs 3.6 µs +5.59%
new[Input] 10.4 µs 9.9 µs +4.99%
mutating[10] 13.9 µs 13.3 µs +4.37%
mutating[20] 14.1 µs 13.5 µs +4.31%
mutating[30] 14.2 µs 13.6 µs +4.27%

@MichaReiser
Copy link
Contributor Author

Wow, that's unexpected. Maybe this is because we now avoid claiming the stack if there are no cycle heads?

Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

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

Nice! That's odd because I thought I had tried this and seen no difference. But I didn't have the short-circuit if empty; maybe that is the difference? It doesn't quite make sense to me, because we should only enter this function for provisional memos, which mean they have cycle heads.

But anyway, the code looks fine, and certainly can't argue with the benchmark results!

@MichaReiser MichaReiser added this pull request to the merge queue Apr 10, 2025
Merged via the queue into salsa-rs:master with commit 736e66e Apr 10, 2025
11 checks passed
@MichaReiser MichaReiser deleted the cycle-heads-reuse-stack branch April 10, 2025 15:00
@github-actions github-actions bot mentioned this pull request Apr 10, 2025
@davidbarsky
Copy link
Contributor

Oh wow, this basically removes the (small, worthwhile!) performance penalty that #603 introduced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Code works but is messy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants