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

Early unsubscribe #258

Merged
merged 10 commits into from
Sep 7, 2022
Merged

Early unsubscribe #258

merged 10 commits into from
Sep 7, 2022

Conversation

victimsnino
Copy link
Owner

No description provided.

@codecov
Copy link

codecov bot commented Sep 6, 2022

Codecov Report

Merging #258 (51cad83) into main (80e2603) will decrease coverage by 0.22%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #258      +/-   ##
==========================================
- Coverage   98.43%   98.20%   -0.23%     
==========================================
  Files          92       93       +1     
  Lines        1338     1340       +2     
==========================================
- Hits         1317     1316       -1     
- Misses         21       24       +3     
Impacted Files Coverage Δ
src/rpp/rpp/operators/combine_latest.hpp 100.00% <100.00%> (ø)
src/rpp/rpp/operators/concat.hpp 100.00% <100.00%> (ø)
...rc/rpp/rpp/operators/details/early_unsubscribe.hpp 100.00% <100.00%> (ø)
src/rpp/rpp/operators/merge.hpp 100.00% <100.00%> (ø)
src/rpp/rpp/operators/switch_on_next.hpp 100.00% <100.00%> (ø)
src/rpp/rpp/operators/with_latest_from.hpp 100.00% <100.00%> (ø)
...c/rpp/rpp/subscriptions/composite_subscription.hpp 87.87% <0.00%> (-4.55%) ⬇️
src/rpp/rpp/operators/lift.hpp 100.00% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2022

BENCHMARK RESULTS (AUTOGENERATED)

ci-ubuntu-clang

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 0.34ns 0.402125 0.83 0.33ns
Dynamic observable construction 33.19ns 39.8506 0.83 24.72ns
Specific observable construction + as_dynamic 29.15ns 35.1352 0.83 24.71ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 111.98ns 135.614 0.83 290.15ns
Specific observable lift dynamic observer 134.12ns 160.903 0.83 330.83ns
Dynamic observable lift specific observer 185.03ns 220.909 0.84 336.87ns
Dynamic observable lift dynamic observer 191.08ns 228.327 0.84 323.47ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 77.38ns 92.9761 0.83 285.24ns
Specific observable subscribe dynamic observer 90.76ns 110.417 0.82 295.55ns
Dynamic observable subscribe specific observer 148.21ns 175.037 0.85 330.83ns
Dynamic observable subscribe dynamic observer 140.26ns 167.724 0.84 320.46ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 75.70ns 90.8932 0.83 285.79ns
Dynamic observable subscribe lambda 141.40ns 170.739 0.83 327.81ns
Specific observable subscribe lambda without subscription 75.63ns 88.7157 0.85 286.51ns
Dynamic observable subscribe lambda without subscription 139.01ns 166.915 0.83 325.73ns
Specific observable subscribe specific subscriber 43.22ns 51.8355 0.83 222.68ns
Dynamic observable subscribe specific subscriber 107.68ns 127.799 0.84 264.73ns
Specific observable subscribe dynamic observer 43.54ns 52.1748 0.83 238.42ns
Dynamic observable subscribe dynamic observer 94.22ns 112.404 0.84 273.62ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 0.34ns 0.404376 0.83 0.34ns
Dynamic observer construction 29.16ns 35.0503 0.83 21.92ns
Specific observer construction + as_dynamic 29.17ns 35.1146 0.83 22.60ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.67ns 0.804424 0.83 0.67ns
Dynamic observer OnNext 1.68ns 2.01267 0.83 2.34ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 32.47ns 38.9802 0.83 64.86ns
Make copy of subscriber 16.74ns 20.0961 0.83 4.70ns
Transform subsriber to dynamic 43.61ns 52.314 0.83 28.13ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 32.45ns 38.6034 0.84 52.10ns
composite_subscription add 49.39ns 59.1081 0.84 78.25ns
composite_subscription unsubscribe 44.24ns 52.6345 0.84 23.01ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 266.66ns 304.289 0.88 1878.85ns
sending of values from observable via buffer to subscriber 6.36ns 7.84385 0.81 27.01ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 281.23ns 323.38 0.87 494.25ns
long stateful chain creation + subscribe 399.42ns 490.699 0.81 797.34ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 774.71ns 755.968 1.02 953.71ns
sending of values from observable via combine_latest to subscriber 18.04ns 21.1983 0.85 2.35ns

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 1732.63ns 1691.17 1.02 3379.28ns
concat_with 1969.15ns 2058.97 0.96 3784.32ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 127.70ns 153.443 0.83 258.84ns
sending of values from observable via distinct_until_changed to subscriber 2.34ns 2.81331 0.83 2.01ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 141.06ns 172.984 0.82 591.42ns
sending of values from observable via first to subscriber 0.67ns 0.773535 0.87 0.67ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 84.28ns 102.571 0.82 633.78ns
error 134.68ns 161.791 0.83 742.19ns
never 47.26ns 56.5051 0.84 250.50ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 99.02ns 110.789 0.89 667.95ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 1.34ns 0.804811 1.67 111.43ns
re-schedule 10 times 11.40ns 10.0639 1.13 143.57ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 85.97ns 99.2622 0.87 636.79ns
just send variadic 116.18ns 140.861 0.82 748.46ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 89.09ns 106.893 0.83 248.59ns
sending of values from observable via map to subscriber 1.00ns 1.20623 0.83 1.53ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 1655.85ns 1582.39 1.05 3362.96ns
merge_with 1896.57ns 1883.14 1.01 3651.40ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 576.82ns 698.529 0.83 2632.35ns
sending of values from observable via observe_on to subscriber 89.25ns 108.719 0.82 200.05ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 24.10ns 29.1171 0.83 10.16ns
on_error 0.67ns 0.60575 1.11 19.18ns
on_completed 0.67ns 0.606899 1.11 0.67ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 199.21ns 237.475 0.84 178.44ns
get_observable 26.45ns 34.9829 0.76 49.12ns
get_subscriber 58.19ns 72.754 0.80 14.05ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 3942.02ns 4803.95 0.82 3104.75ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 125.94ns 150.79 0.84 300.46ns
sending of values from observable via scan to subscriber 2.01ns 2.41176 0.83 2.01ns

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 122.87ns 131.509 0.93 484.32ns
sending of values from observable via skip to subscriber 2.01ns 2.03455 0.99 1.77ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 2080.66ns 2252.76 0.92 3006.78ns
sending of values from observable via switch_on_next to subscriber 534.32ns 649.045 0.82 688.54ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 185.12ns 224.078 0.83 498.79ns
sending of values from observable via take to subscriber 2.35ns 2.7695 0.85 3.36ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 231.82ns 270.906 0.86 533.08ns
sending of values from observable via take_last to subscriber 2.88ns 4.43973 0.65 4.11ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 14.10ns 14.0837 1.00 157.40ns
re-schedule 10 times 33.49ns 35.9371 0.93 192.09ns
recursively schedule 10 times 1385.87ns 1706.21 0.81 5618.10ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 2018.68ns 2352.85 0.86 3153.06ns
sending of values from observable via window to subscriber 543.06ns 661.156 0.82 371.81ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 949.33ns 761.104 1.25 1162.91ns
sending of values from observable via with_latest_from to subscriber 34.47ns 41.5781 0.83 3.31ns

ci-ubuntu-gcc

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 0.33ns 0.345964 0.97 0.34ns
Dynamic observable construction 31.47ns 24.9068 1.26 22.81ns
Specific observable construction + as_dynamic 31.48ns 24.6656 1.28 23.04ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 119.30ns 102.302 1.17 329.44ns
Specific observable lift dynamic observer 147.47ns 127.469 1.16 344.46ns
Dynamic observable lift specific observer 200.38ns 174.82 1.15 382.29ns
Dynamic observable lift dynamic observer 214.41ns 185.992 1.15 363.43ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 83.41ns 69.5433 1.20 345.89ns
Specific observable subscribe dynamic observer 95.24ns 82.5551 1.15 329.23ns
Dynamic observable subscribe specific observer 150.41ns 129.706 1.16 362.50ns
Dynamic observable subscribe dynamic observer 147.99ns 129.763 1.14 339.68ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 82.83ns 68.9024 1.20 323.68ns
Dynamic observable subscribe lambda 149.61ns 129.535 1.15 361.29ns
Specific observable subscribe lambda without subscription 82.72ns 68.7828 1.20 322.87ns
Dynamic observable subscribe lambda without subscription 149.07ns 129.438 1.15 364.94ns
Specific observable subscribe specific subscriber 50.26ns 42.3865 1.19 269.28ns
Dynamic observable subscribe specific subscriber 121.50ns 107.389 1.13 310.79ns
Specific observable subscribe dynamic observer 50.31ns 42.4192 1.19 277.30ns
Dynamic observable subscribe dynamic observer 104.53ns 89.6826 1.17 288.58ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 0.34ns 0.346539 0.97 0.34ns
Dynamic observer construction 31.55ns 24.9555 1.26 20.51ns
Specific observer construction + as_dynamic 31.60ns 24.9682 1.27 20.43ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.33ns 0.355924 0.94 0.34ns
Dynamic observer OnNext 1.68ns 1.38383 1.21 2.01ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 34.87ns 29.2045 1.19 57.76ns
Make copy of subscriber 16.75ns 13.8841 1.21 4.45ns
Transform subsriber to dynamic 44.36ns 38.5479 1.15 26.81ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 34.89ns 29.189 1.20 55.48ns
composite_subscription add 46.58ns 43.6706 1.07 101.87ns
composite_subscription unsubscribe 41.97ns 37.4444 1.12 22.04ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 254.53ns 221.164 1.15 1858.82ns
sending of values from observable via buffer to subscriber 6.58ns 5.56654 1.18 31.20ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 307.68ns 391.76 0.79 708.69ns
long stateful chain creation + subscribe 432.36ns 393.326 1.10 1071.42ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 814.44ns 588.729 1.38 1110.82ns
sending of values from observable via combine_latest to subscriber 20.42ns 19.0631 1.07 2.35ns

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 1783.31ns 1331.05 1.34 3612.35ns
concat_with 2040.48ns 1584.49 1.29 3882.51ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 143.16ns 121.762 1.18 353.53ns
sending of values from observable via distinct_until_changed to subscriber 3.72ns 2.76553 1.34 1.34ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 163.69ns 142.847 1.15 693.91ns
sending of values from observable via first to subscriber 0.67ns 1.38643 0.48 1.01ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 88.05ns 74.2925 1.19 735.25ns
error 131.41ns 116.639 1.13 852.95ns
never 49.63ns 40.2279 1.23 282.94ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 107.16ns 88.2086 1.21 771.49ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 1.68ns 1.03238 1.62 133.89ns
re-schedule 10 times 22.80ns 17.3365 1.32 158.89ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 89.91ns 77.3493 1.16 771.57ns
just send variadic 127.99ns 97.9221 1.31 827.09ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 101.00ns 94.2734 1.07 342.61ns
sending of values from observable via map to subscriber 0.84ns 0.865931 0.97 2.34ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 1710.18ns 1280.34 1.34 3763.51ns
merge_with 1973.81ns 1515.82 1.30 4052.76ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 614.69ns 584.322 1.05 3010.01ns
sending of values from observable via observe_on to subscriber 88.55ns 80.0822 1.11 237.15ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 22.47ns 26.215 0.86 9.85ns
on_error 0.67ns 0.69709 0.97 16.84ns
on_completed 0.67ns 0.749034 0.90 1.01ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 209.04ns 183.808 1.14 173.31ns
get_observable 29.46ns 26.3293 1.12 48.26ns
get_subscriber 57.23ns 54.8709 1.04 22.86ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 4140.51ns 3754.12 1.10 3152.71ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 136.99ns 117.366 1.17 388.90ns
sending of values from observable via scan to subscriber 3.35ns 2.07689 1.61 2.34ns

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 134.23ns 116.28 1.15 527.78ns
sending of values from observable via skip to subscriber 3.02ns 3.14211 0.96 2.35ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 2196.85ns 1824.99 1.20 4269.16ns
sending of values from observable via switch_on_next to subscriber 556.34ns 512.757 1.08 1062.14ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 191.12ns 166.203 1.15 603.94ns
sending of values from observable via take to subscriber 4.06ns 3.46729 1.17 3.78ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 229.13ns 201.308 1.14 629.09ns
sending of values from observable via take_last to subscriber 3.37ns 3.11829 1.08 5.95ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 20.74ns 15.5377 1.34 182.76ns
re-schedule 10 times 49.21ns 33.4351 1.47 217.72ns
recursively schedule 10 times 1498.10ns 1238.09 1.21 6319.02ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 2165.07ns 1949.92 1.11 3227.11ns
sending of values from observable via window to subscriber 582.98ns 525.385 1.11 417.36ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 1010.96ns 629.697 1.61 1467.54ns
sending of values from observable via with_latest_from to subscriber 34.75ns 35.644 0.97 4.19ns

ci-windows

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 1.82ns 2.02568 0.90 0.81ns
Dynamic observable construction 97.46ns 101.447 0.96 147.44ns
Specific observable construction + as_dynamic 96.10ns 106.181 0.91 147.91ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 214.26ns 207.88 1.03 1436.40ns
Specific observable lift dynamic observer 251.25ns 247.306 1.02 1527.76ns
Dynamic observable lift specific observer 368.13ns 410.951 0.90 1680.05ns
Dynamic observable lift dynamic observer 315.06ns 315.945 1.00 1874.95ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 166.15ns 172.367 0.96 1396.19ns
Specific observable subscribe dynamic observer 181.36ns 219.57 0.83 1462.24ns
Dynamic observable subscribe specific observer 307.34ns 308.67 1.00 1552.68ns
Dynamic observable subscribe dynamic observer 239.53ns 272.835 0.88 1500.00ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 167.09ns 170.955 0.98 1403.59ns
Dynamic observable subscribe lambda 308.24ns 302.459 1.02 1614.65ns
Specific observable subscribe lambda without subscription 167.73ns 167.136 1.00 1426.18ns
Dynamic observable subscribe lambda without subscription 307.66ns 334.091 0.92 1612.89ns
Specific observable subscribe specific subscriber 81.53ns 58.5246 1.39 1002.48ns
Dynamic observable subscribe specific subscriber 204.07ns 198.169 1.03 1223.33ns
Specific observable subscribe dynamic observer 63.61ns 60.6439 1.05 1048.21ns
Dynamic observable subscribe dynamic observer 118.95ns 138.466 0.86 1094.42ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 1.80ns 1.98691 0.90 1.83ns
Dynamic observer construction 98.12ns 101.946 0.96 139.67ns
Specific observer construction + as_dynamic 98.11ns 98.4509 1.00 161.11ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.81ns 0.772088 1.05 0.81ns
Dynamic observer OnNext 2.43ns 2.32448 1.05 2.26ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 102.65ns 120.203 0.85 359.05ns
Make copy of subscriber 20.05ns 17.8065 1.13 49.03ns
Transform subsriber to dynamic 115.33ns 114.365 1.01 179.99ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 111.69ns 103.849 1.08 403.72ns
composite_subscription add 82.85ns 91.5411 0.91 183.88ns
composite_subscription unsubscribe 74.45ns 73.013 1.02 145.45ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 486.68ns 452.25 1.08 5654.67ns
sending of values from observable via buffer to subscriber 7.84ns 8.27455 0.95 116.42ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 338.37ns 346.29 0.98 2053.38ns
long stateful chain creation + subscribe 805.49ns 821.735 0.98 4249.00ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 1971.67ns 1658.1 1.19 3628.62ns
sending of values from observable via combine_latest to subscriber 45.46ns 40.0042 1.14 5.75ns

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 4332.20ns 3464.33 1.25 12615.30ns
concat_with 3901.25ns 3340.22 1.17 13705.70ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 227.12ns 291.658 0.78 1228.68ns
sending of values from observable via distinct_until_changed to subscriber 4.48ns 4.62805 0.97 4.70ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 169.49ns 186.095 0.91 3100.20ns
sending of values from observable via first to subscriber 2.83ns 3.31508 0.85 2.17ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 98.85ns 98.6683 1.00 2835.82ns
error 165.82ns 185.896 0.89 2939.40ns
never 59.44ns 60.5382 0.98 1445.21ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 181.78ns 196.144 0.93 2943.55ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 2.12ns 1.6282 1.30 486.37ns
re-schedule 10 times 115.48ns 127.198 0.91 524.91ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 108.10ns 107.661 1.00 2859.20ns
just send variadic 152.67ns 245.596 0.62 2914.82ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 127.20ns 126.711 1.00 1190.00ns
sending of values from observable via map to subscriber 3.72ns 3.96465 0.94 7.71ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 2836.55ns 2374.75 1.19 12490.30ns
merge_with 3711.50ns 3160.11 1.17 13525.70ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 976.45ns 1045.5 0.93 6865.40ns
sending of values from observable via observe_on to subscriber 108.18ns 104.913 1.03 935.53ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 24.45ns 25.1053 0.97 42.96ns
on_error 4.39ns 3.91497 1.12 22.14ns
on_completed 3.24ns 3.05937 1.06 1.63ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 439.97ns 445.0 0.99 1476.42ns
get_observable 34.48ns 33.9045 1.02 197.30ns
get_subscriber 61.88ns 65.4761 0.95 106.79ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 7314.00ns 7622.33 0.96 14772.70ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 247.93ns 280.602 0.88 1436.55ns
sending of values from observable via scan to subscriber 6.49ns 7.88582 0.82 10.47ns

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 249.73ns 240.117 1.04 1799.80ns
sending of values from observable via skip to subscriber 4.40ns 4.27954 1.03 4.76ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 4442.86ns 3742.5 1.19 14433.00ns
sending of values from observable via switch_on_next to subscriber 973.16ns 2803.97 0.35 3716.22ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 296.74ns 296.949 1.00 2507.92ns
sending of values from observable via take to subscriber 7.17ns 7.29225 0.98 7.11ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 411.21ns 423.0 0.97 2919.30ns
sending of values from observable via take_last to subscriber 5.27ns 6.78472 0.78 25.99ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 23.76ns 22.0683 1.08 732.83ns
re-schedule 10 times 145.10ns 149.025 0.97 782.26ns
recursively schedule 10 times 3354.60ns 3409.0 0.98 22675.00ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 3577.44ns 3692.75 0.97 12052.00ns
sending of values from observable via window to subscriber 993.22ns 1035.33 0.96 1922.53ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 2469.75ns 1421.1 1.74 4550.83ns
sending of values from observable via with_latest_from to subscriber 65.06ns 59.0245 1.10 9.54ns


state->count_of_on_completed_needed.fetch_add(1, std::memory_order::relaxed);

auto subscription = subscriber.get_subscription().make_child();
auto subscription = state->childs_subscriptions.make_child();
Copy link
Contributor

@tcw165 tcw165 Sep 7, 2022

Choose a reason for hiding this comment

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

Here is the component diagram for subscription from the original behavior.

image

In the new behavior, you create merge_sub_child_1 --> merge_sub_child_2 and then early-unsubscribe to merge_sub_child_1 (will unsubscribe merge_sub_child_2 eventually). Is it too many layers?

Note I use "scbr" for subscriber and "sub" for subscription.

  { original }                     { new }

sub_a       sub_b              sub_a       sub_b
  \         /                    \         /
   merge_sub                     merge_sub_2    <-- seen by merge_scbr
      |                               |
      |                          merge_sub_1    <-- used for early unsubscribing
      |                               |
     sub                             sub

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see. I plot the subscription tree wrong. It's a brilliant idea and the correct plot should be

  { original }                     { new }

sub_a       sub_b          sub_a             sub_b
  \         /                |                 |
   merge_sub                  \  merge_sub_2  / <-- seen by merge_scbr
      |                        \      |      /
      |                          merge_sub_1    <-- used for early unsubscribing
      |                               |
     sub                             sub

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 7, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@victimsnino victimsnino merged commit a3f59ab into main Sep 7, 2022
@victimsnino victimsnino deleted the early_unsubscribe branch September 7, 2022 20:07
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