Skip to content

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

Merged
MichaReiser merged 1 commit intosalsa-rs:masterfrom
MichaReiser:cycle-heads-reuse-stack
Apr 10, 2025
Merged

[refactor] Reuse the same stack for all cycles heads in validate_same_iteration#791
MichaReiser merged 1 commit intosalsa-rs:masterfrom
MichaReiser:cycle-heads-reuse-stack

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
@netlify
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

@codspeed-hq
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