Skip to content

Conversation

@yannham
Copy link
Member

@yannham yannham commented Dec 5, 2025

Depends on #2455.

This commit mostly copies the style of the stdlib in std::rc::Rc, in hope of gaining the same kind of optimizations. It does nullify the loss of #2455, and wins overall 5-7% on the OPL benchmark in runtime when compared to master. After a bit of experimentation, it seems that the [u8; 7] representation had to go for those optimizations to fire properly.

@yannham yannham requested a review from jneem December 5, 2025 16:37
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

🐰 Bencher Report

Branchperf/optimize-refcounting
Testbedubuntu-latest

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymicroseconds (µs)
diagnostics-benches/inputs/goto-perf.ncl📈 view plot
⚠️ NO THRESHOLD
8,066.80 µs
diagnostics-benches/inputs/large-record-tree.ncl📈 view plot
⚠️ NO THRESHOLD
166,450.00 µs
diagnostics-benches/inputs/redis-replication-controller.ncl📈 view plot
⚠️ NO THRESHOLD
226.73 µs
diagnostics-benches/inputs/small-record-tree.ncl📈 view plot
⚠️ NO THRESHOLD
372.35 µs
fibonacci 10📈 view plot
⚠️ NO THRESHOLD
199.18 µs
foldl arrays 50📈 view plot
⚠️ NO THRESHOLD
374.62 µs
foldl arrays 500📈 view plot
⚠️ NO THRESHOLD
2,868.50 µs
foldr strings 50📈 view plot
⚠️ NO THRESHOLD
2,984.60 µs
foldr strings 500📈 view plot
⚠️ NO THRESHOLD
29,964.00 µs
generate normal 250📈 view plot
⚠️ NO THRESHOLD
31,613.00 µs
generate normal 50📈 view plot
⚠️ NO THRESHOLD
1,306.90 µs
generate normal unchecked 1000📈 view plot
⚠️ NO THRESHOLD
1,668.60 µs
generate normal unchecked 200📈 view plot
⚠️ NO THRESHOLD
337.86 µs
init-diagnostics-benches/inputs/goto-perf.ncl📈 view plot
⚠️ NO THRESHOLD
46,738.00 µs
init-diagnostics-benches/inputs/large-record-tree.ncl📈 view plot
⚠️ NO THRESHOLD
186,600.00 µs
init-diagnostics-benches/inputs/redis-replication-controller.ncl📈 view plot
⚠️ NO THRESHOLD
42,321.00 µs
init-diagnostics-benches/inputs/small-record-tree.ncl📈 view plot
⚠️ NO THRESHOLD
42,397.00 µs
pidigits 100📈 view plot
⚠️ NO THRESHOLD
1,999.60 µs
pipe normal 20📈 view plot
⚠️ NO THRESHOLD
578.59 µs
pipe normal 200📈 view plot
⚠️ NO THRESHOLD
4,574.60 µs
product 30📈 view plot
⚠️ NO THRESHOLD
251.73 µs
requests-benches/inputs/goto-perf.ncl-000📈 view plot
⚠️ NO THRESHOLD
2,927.20 µs
requests-benches/inputs/large-record-tree.ncl-000📈 view plot
⚠️ NO THRESHOLD
462,750.00 µs
requests-benches/inputs/large-record-tree.ncl-001📈 view plot
⚠️ NO THRESHOLD
81.46 µs
scalar 10📈 view plot
⚠️ NO THRESHOLD
477.80 µs
sum 30📈 view plot
⚠️ NO THRESHOLD
260.10 µs
🐰 View full continuous benchmarking report in Bencher


fn decr_ref_count(&mut self) {
#[inline]
fn dec_ref_count(&self) {
Copy link
Member

Choose a reason for hiding this comment

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

Is it not worthwhile to assert here that count != 0? (Naively, I'd expect this one to be more valuable than the other one, because it means the subtraction can't overflow)

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