Skip to content

Conversation

medz
Copy link
Owner

@medz medz commented Dec 19, 2024

Recursive calls vs. No recursion Benchmark Comparison Report

Benchmark Comparison Table:

Test Category Test Case Recursive calls (μs) No recursion (μs) Change (μs) Change (%) Performance Change
Propagation avoidablePropagation 104272 80050 -24222 -23.2% Significant Improvement (Large Decrease)
broadPropagation 183044 184638 1594 0.9% Little Change (Essentially Flat)
deepPropagation 77191 54170 -23021 -29.8% Significant Improvement (Large Decrease)
diamond 126867 107900 -18967 -15.0% Improvement (Noticeable Decrease)
mux 197853 194765 -3088 -1.6% Little Change (Slight Decrease)
triangle 53633 52221 -1412 -2.6% Slight Improvement (Slight Decrease)
Observers repeatedObservers 14215 12850 -1365 -9.6% Slight Improvement (Slight Decrease)
Large-Scale molBench 325145 330550 5405 1.7% Slight Regression (Slight Increase)
Components comp_0to1 979 873 -106 -10.8% Improvement (Noticeable Decrease)
comp_1to1 2883 1654 -1229 -42.6% Significant Improvement (Large Decrease)
comp_2to1 1794 1412 -382 -21.3% Improvement (Noticeable Decrease)
comp_4to1 1916 1587 -329 -17.2% Improvement (Noticeable Decrease)
comp_1000to1 13 6 -7 -53.8% Significant Improvement (Large Decrease)
comp_1to2 1505 1253 -252 -16.7% Improvement (Noticeable Decrease)
comp_1to4 1503 3079 1576 104.9% Significant Regression (Large Increase)
comp_1to8 1558 2507 949 60.9% Significant Regression (Large Increase)
comp_1to1000 429 460 31 7.2% Slight Regression (Slight Increase)
Updates update_1to1 3547 2671 -876 -24.7% Improvement (Noticeable Decrease)
update_2to1 1425 1511 86 6.0% Slight Regression (Slight Increase)
update_4to1 671 686 15 2.2% Slight Regression (Slight Increase)
update_1000to1 11 10 -1 -9.1% Slight Improvement (Slight Decrease)
update_1to2 1535 1528 -7 -0.5% Little Change (Essentially Flat)
update_1to4 695 690 -5 -0.7% Little Change (Essentially Flat)
update_1to1000 23 23 0 0.0% No Change
Cellular cellx1000 4163 4383 220 5.3% Slight Regression (Slight Increase)
cellx2500 10207 11839 1632 16.0% Noticeable Regression (Noticeable Increase)
cellx5000 27705 26234 -1471 -5.3% Slight Improvement (Slight Decrease)
Grid 10x5 - 2 sources - read 20.0% (simple) 204985 203574 -1411 -0.7% Little Change (Essentially Flat)
10x10 - 6 sources - dynamic - read 20.0% (dynamic) 120424 116255 -4169 -3.5% Slight Improvement (Slight Decrease)
1000x12 - 4 sources - dynamic (large) 229409 222962 -6447 -2.8% Slight Improvement (Slight Decrease)
1000x5 - 25 sources (wide dense) 303129 303695 566 0.2% Little Change (Essentially Flat)
5x500 - 3 sources (deep) 124582 119665 -4917 -4.0% Slight Improvement (Slight Decrease)
100x15 - 6 sources - dynamic (very dynamic) 168315 166657 -1658 -1.0% Little Change (Essentially Flat)
  • Simple averages show that the average improvement for the improved test cases is about 17.2%.
  • A conservative estimate is that the overall average performance improvement for "No recursion" is between 10% and 17%.

@medz medz changed the title perf: Eliminate recursive calls perf: Eliminate recursive calls - Improved by approximately **17%** Dec 19, 2024
@johnsoncodehk
Copy link
Contributor

johnsoncodehk commented Dec 19, 2024

It may also be worth to try keep checkDirty simple and only eliminate recursive calls for propagate. Because only propagate can obtains an additional fast path by eliminating recursive calls, see stackblitz/alien-signals#7 (comment).

@medz
Copy link
Owner Author

medz commented Dec 19, 2024

It may also be worth to try keep checkDirty simple and only eliminate recursive calls for propagate. Because only propagate can obtains an additional fast path by eliminating recursive calls, see stackblitz/alien-signals#7 (comment).

OK,I will re-experiment.

@medz medz merged commit d22f6b6 into main Dec 19, 2024
@medz medz deleted the perf/remove-recursive-calls branch December 19, 2024 10:45
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.

2 participants