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

Add behavior subject #303

Merged
merged 6 commits into from
Dec 5, 2022
Merged

Add behavior subject #303

merged 6 commits into from
Dec 5, 2022

Conversation

victimsnino
Copy link
Owner

@victimsnino victimsnino commented Dec 4, 2022

@codecov
Copy link

codecov bot commented Dec 4, 2022

Codecov Report

Merging #303 (e2540f2) into main (39974ba) will decrease coverage by 0.02%.
The diff coverage is 97.36%.

@@            Coverage Diff             @@
##             main     #303      +/-   ##
==========================================
- Coverage   98.27%   98.24%   -0.03%     
==========================================
  Files         109      110       +1     
  Lines        1562     1596      +34     
==========================================
+ Hits         1535     1568      +33     
- Misses         27       28       +1     
Impacted Files Coverage Δ
src/rpp/rpp/subjects/behavior_subject.hpp 96.87% <96.87%> (ø)
src/rpp/rpp/subjects/details/base_subject.hpp 100.00% <100.00%> (ø)
src/rpp/rpp/subjects/publish_subject.hpp 100.00% <100.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 Dec 5, 2022

BENCHMARK RESULTS (AUTOGENERATED)

ci-macos

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 0.29ns 0.277717 1.03 0.51ns
Dynamic observable construction 112.22ns 88.0895 1.27 111.27ns
Specific observable construction + as_dynamic 73.76ns 71.7051 1.03 386.13ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 185.76ns 134.482 1.38 1078.97ns
Specific observable lift dynamic observer 183.06ns 160.659 1.14 1126.54ns
Dynamic observable lift specific observer 242.76ns 262.611 0.92 1287.80ns
Dynamic observable lift dynamic observer 213.01ns 215.569 0.99 1201.45ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 122.11ns 118.406 1.03 1061.58ns
Specific observable subscribe dynamic observer 123.60ns 133.775 0.92 1166.29ns
Dynamic observable subscribe specific observer 219.58ns 254.168 0.86 1196.56ns
Dynamic observable subscribe dynamic observer 168.93ns 152.51 1.11 1175.54ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 138.04ns 104.526 1.32 1413.95ns
Dynamic observable subscribe lambda 233.00ns 223.433 1.04 1237.25ns
Specific observable subscribe lambda without subscription 545.76ns 115.766 4.71 1326.68ns
Dynamic observable subscribe lambda without subscription 222.17ns 211.575 1.05 1203.40ns
Specific observable subscribe specific subscriber 36.30ns 45.225 0.80 832.86ns
Dynamic observable subscribe specific subscriber 138.65ns 131.038 1.06 952.21ns
Specific observable subscribe dynamic observer 32.00ns 46.8377 0.68 809.37ns
Dynamic observable subscribe dynamic observer 81.78ns 70.7723 1.16 979.51ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 0.28ns 0.278933 1.01 0.28ns
Dynamic observer construction 73.61ns 66.7409 1.10 98.89ns
Specific observer construction + as_dynamic 72.85ns 68.1397 1.07 103.39ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.89ns 0.777615 1.15 0.78ns
Dynamic observer OnNext 3.01ns 2.10217 1.43 2.16ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 134.12ns 70.7649 1.90 309.39ns
Make copy of subscriber 12.50ns 13.7521 0.91 26.79ns
Transform subsriber to dynamic 89.39ns 85.879 1.04 127.53ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 424.81ns 75.9054 5.60 298.64ns
composite_subscription add 77.96ns 55.4377 1.41 113.43ns
composite_subscription unsubscribe 74.32ns 69.9727 1.06 109.77ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 348.15ns 328.406 1.06 3130.29ns
sending of values from observable via buffer to subscriber 5.84ns 6.53838 0.89 85.85ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 276.06ns 214.456 1.29 1360.89ns
long stateful chain creation + subscribe 756.99ns 525.012 1.44 2641.78ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 1351.14ns 1329.69 1.02 .
sending of values from observable via combine_latest to subscriber 33.35ns 28.1057 1.19 .

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 2685.29ns 2593.05 1.04 9581.57ns
concat_with 3105.81ns 3048.7 1.02 12433.50ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 152.89ns 164.09 0.93 1020.48ns
sending of values from observable via distinct_until_changed to subscriber 2.26ns 2.24993 1.01 1.16ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 130.40ns 118.328 1.10 2122.64ns
sending of values from observable via first to subscriber 1.08ns 0.83931 1.29 0.89ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 63.85ns 91.2841 0.70 2317.04ns
error 111.80ns 108.514 1.03 2261.62ns
never 32.40ns 32.0585 1.01 816.58ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 151.00ns 139.059 1.09 2556.07ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 2.09ns 2.2335 0.94 395.42ns
re-schedule 10 times 39.63ns 25.5044 1.55 415.75ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 64.88ns 63.9897 1.01 2138.35ns
just send variadic 91.71ns 103.061 0.89 2231.27ns

last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
last construction from observable via dot + subscribe 215.30ns 207.472 1.04 1261.43ns
sending of values from observable via last to subscriber 6.54ns 2.48502 2.63 1.26ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 546.41ns 64.7687 8.44 3354.39ns
sending of values from observable via map to subscriber 3.27ns 1.14394 2.86 1.47ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 2764.08ns 2569.89 1.08 9189.77ns
merge_with 3692.61ns 3140.35 1.18 11078.80ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 620.11ns 648.505 0.96 9447.90ns
sending of values from observable via observe_on to subscriber 115.82ns 101.29 1.14 796.78ns

on_error_resume_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_error_resume_next construction from observable via dot + subscribe 592.57ns 568.111 1.04 1582.12ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 20.63ns 20.7318 1.00 27.76ns
on_error 0.84ns 0.56714 1.49 16.82ns
on_completed 0.60ns 0.570642 1.06 2.25ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 354.07ns 326.759 1.08 524.14ns
get_observable 26.48ns 26.4345 1.00 152.48ns
get_subscriber 53.22ns 51.7053 1.03 78.13ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 6006.96ns 5537.34 1.08 9783.66ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 143.26ns 141.953 1.01 1149.19ns
sending of values from observable via scan to subscriber 4.87ns 2.57127 1.89 1.97ns

single-threaded locks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no-lock increment 2.03ns 1.78693 1.13 .
mutex lock increment 23.04ns 22.8849 1.01 .
spin-lock increment 25.19ns 8.18933 3.08 .

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 138.44ns 158.381 0.87 1341.34ns
sending of values from observable via skip to subscriber 2.24ns 2.21336 1.01 1.87ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 3306.42ns 3181.66 1.04 11537.20ns
sending of values from observable via switch_on_next to subscriber 795.48ns 804.81 0.99 6209.37ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 205.64ns 212.262 0.97 2044.71ns
sending of values from observable via take to subscriber 3.01ns 2.72246 1.10 7.44ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 316.72ns 291.773 1.09 1967.86ns
sending of values from observable via take_last to subscriber 2.81ns 2.7138 1.04 5.62ns

take_until

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_until construction from observable via dot + subscribe 1979.53ns 1485.59 1.33 4553.84ns
sending of values from observable via take_until to subscriber 9.51ns 7.80105 1.22 2.27ns

timeout

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
timeout construction from observable via dot + subscribe with run_loop 6338.43ns 6221.39 1.02 4304.81ns
sending of values from observable via timeout to subscriber with unreachable timeout interval with run_loop 68.06ns 68.7301 0.99 903.87ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 30.98ns 42.7089 0.73 620.24ns
re-schedule 10 times 96.88ns 85.9416 1.13 615.91ns
recursively schedule 10 times 2223.67ns 1904.53 1.17 15904.50ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 7450.21ns 3033.75 2.46 7950.21ns
sending of values from observable via window to subscriber 855.28ns 843.619 1.01 1534.56ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 1580.97ns 1586.76 1.00 .
sending of values from observable via with_latest_from to subscriber 27.92ns 27.6929 1.01 .

ci-ubuntu-clang

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 0.35ns 0.335415 1.03 0.35ns
Dynamic observable construction 37.41ns 29.2324 1.28 26.25ns
Specific observable construction + as_dynamic 29.88ns 29.1828 1.02 28.97ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 102.68ns 89.0336 1.15 363.87ns
Specific observable lift dynamic observer 122.28ns 110.987 1.10 369.94ns
Dynamic observable lift specific observer 210.28ns 169.62 1.24 413.54ns
Dynamic observable lift dynamic observer 192.92ns 173.115 1.11 379.98ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 63.41ns 57.9734 1.09 328.39ns
Specific observable subscribe dynamic observer 75.05ns 71.5795 1.05 449.86ns
Dynamic observable subscribe specific observer 133.06ns 126.955 1.05 344.17ns
Dynamic observable subscribe dynamic observer 150.17ns 121.649 1.23 345.66ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 69.54ns 58.0986 1.20 326.88ns
Dynamic observable subscribe lambda 136.67ns 124.493 1.10 331.86ns
Specific observable subscribe lambda without subscription 58.12ns 58.0486 1.00 358.62ns
Dynamic observable subscribe lambda without subscription 122.96ns 124.348 0.99 401.57ns
Specific observable subscribe specific subscriber 33.19ns 27.8526 1.19 273.10ns
Dynamic observable subscribe specific subscriber 97.68ns 88.2562 1.11 281.31ns
Specific observable subscribe dynamic observer 34.97ns 27.7897 1.26 240.17ns
Dynamic observable subscribe dynamic observer 93.21ns 75.3822 1.24 312.77ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 0.40ns 0.334808 1.20 0.39ns
Dynamic observer construction 33.67ns 29.1528 1.16 21.34ns
Specific observer construction + as_dynamic 32.91ns 29.2035 1.13 23.59ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.84ns 0.670392 1.25 0.80ns
Dynamic observer OnNext 2.47ns 2.01207 1.23 2.17ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 40.63ns 34.8274 1.17 87.44ns
Make copy of subscriber 20.69ns 16.743 1.24 5.03ns
Transform subsriber to dynamic 47.17ns 45.8782 1.03 31.53ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 34.03ns 34.8681 0.98 57.39ns
composite_subscription add 52.86ns 49.2212 1.07 83.11ns
composite_subscription unsubscribe 40.17ns 44.039 0.91 27.75ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 269.79ns 244.739 1.10 1966.22ns
sending of values from observable via buffer to subscriber 5.63ns 5.01944 1.12 29.58ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 293.14ns 260.897 1.12 615.13ns
long stateful chain creation + subscribe 415.55ns 376.989 1.10 1287.52ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 939.56ns 863.07 1.09 .
sending of values from observable via combine_latest to subscriber 36.86ns 27.4476 1.34 .

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 1984.18ns 1874.89 1.06 3826.97ns
concat_with 2516.63ns 2160.08 1.17 3966.46ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 117.92ns 112.712 1.05 296.84ns
sending of values from observable via distinct_until_changed to subscriber 2.84ns 2.67862 1.06 1.36ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 136.22ns 123.45 1.10 721.90ns
sending of values from observable via first to subscriber 0.52ns 0.670977 0.77 0.56ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 70.89ns 63.8468 1.11 766.11ns
error 122.56ns 116.151 1.06 861.40ns
never 29.30ns 28.618 1.02 278.20ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 75.60ns 80.7336 0.94 812.45ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 0.50ns 0.671513 0.75 130.60ns
re-schedule 10 times 11.07ns 9.39149 1.18 165.08ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 61.34ns 64.7432 0.95 790.72ns
just send variadic 105.54ns 95.8723 1.10 886.24ns

last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
last construction from observable via dot + subscribe 222.04ns 168.069 1.32 433.93ns
sending of values from observable via last to subscriber 2.90ns 2.07931 1.39 1.79ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 71.98ns 69.0534 1.04 276.68ns
sending of values from observable via map to subscriber 0.78ns 1.0057 0.78 1.79ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 1896.58ns 1824.19 1.04 4195.87ns
merge_with 2172.42ns 2122.87 1.02 4483.10ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 526.44ns 428.744 1.23 3008.06ns
sending of values from observable via observe_on to subscriber 52.76ns 60.3631 0.87 227.73ns

on_error_resume_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_error_resume_next construction from observable via dot + subscribe 527.85ns 421.313 1.25 680.59ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 28.40ns 24.0539 1.18 12.59ns
on_error 0.58ns 0.505876 1.15 17.28ns
on_completed 0.51ns 0.506086 1.00 0.57ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 236.59ns 201.055 1.18 232.73ns
get_observable 34.97ns 29.0671 1.20 56.27ns
get_subscriber 59.36ns 60.5922 0.98 16.54ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 4443.53ns 3925.28 1.13 3116.06ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 107.70ns 99.5372 1.08 370.38ns
sending of values from observable via scan to subscriber 2.13ns 1.67259 1.27 2.03ns

single-threaded locks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no-lock increment 2.51ns 2.02279 1.24 .
mutex lock increment 23.99ns 18.1001 1.33 .
spin-lock increment 13.58ns 9.03712 1.50 .

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 97.92ns 98.5595 0.99 592.99ns
sending of values from observable via skip to subscriber 3.00ns 1.67677 1.79 2.19ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 2843.84ns 2212.23 1.29 3170.95ns
sending of values from observable via switch_on_next to subscriber 704.18ns 568.947 1.24 781.41ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 214.81ns 168.515 1.27 615.26ns
sending of values from observable via take to subscriber 2.99ns 2.34759 1.27 3.09ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 245.92ns 212.297 1.16 568.89ns
sending of values from observable via take_last to subscriber 3.57ns 3.13363 1.14 4.56ns

take_until

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_until construction from observable via dot + subscribe 1305.45ns 1030.8 1.27 1511.03ns
sending of values from observable via take_until to subscriber 11.74ns 9.04156 1.30 2.05ns

timeout

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
timeout construction from observable via dot + subscribe with run_loop 1292.57ns 1079.0 1.20 20468.50ns
sending of values from observable via timeout to subscriber with unreachable timeout interval with run_loop 65.73ns 57.4825 1.14 18835.30ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 12.95ns 13.0509 0.99 154.50ns
re-schedule 10 times 29.49ns 31.861 0.93 214.87ns
recursively schedule 10 times 1963.28ns 1397.85 1.40 9467.18ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 1947.58ns 2001.61 0.97 3883.17ns
sending of values from observable via window to subscriber 586.17ns 544.503 1.08 416.52ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 1262.24ns 1023.62 1.23 .
sending of values from observable via with_latest_from to subscriber 30.02ns 26.8252 1.12 .

ci-ubuntu-gcc

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 0.38ns 0.401376 0.94 0.40ns
Dynamic observable construction 33.40ns 28.6839 1.16 26.64ns
Specific observable construction + as_dynamic 32.31ns 28.9046 1.12 28.88ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 116.24ns 95.1961 1.22 419.36ns
Specific observable lift dynamic observer 152.82ns 128.938 1.19 449.24ns
Dynamic observable lift specific observer 220.71ns 186.897 1.18 493.63ns
Dynamic observable lift dynamic observer 262.35ns 202.542 1.30 433.43ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 71.29ns 60.1005 1.19 425.29ns
Specific observable subscribe dynamic observer 92.90ns 76.6126 1.21 448.22ns
Dynamic observable subscribe specific observer 152.78ns 129.96 1.18 482.71ns
Dynamic observable subscribe dynamic observer 174.42ns 132.918 1.31 434.71ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 73.17ns 59.2996 1.23 397.45ns
Dynamic observable subscribe lambda 145.17ns 128.951 1.13 486.29ns
Specific observable subscribe lambda without subscription 64.24ns 59.1905 1.09 392.56ns
Dynamic observable subscribe lambda without subscription 152.75ns 128.885 1.19 462.47ns
Specific observable subscribe specific subscriber 36.88ns 26.9694 1.37 319.09ns
Dynamic observable subscribe specific subscriber 100.43ns 97.3333 1.03 333.16ns
Specific observable subscribe dynamic observer 33.86ns 27.8745 1.21 355.03ns
Dynamic observable subscribe dynamic observer 93.32ns 90.8031 1.03 332.80ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 0.42ns 0.401307 1.05 0.34ns
Dynamic observer construction 35.00ns 29.0772 1.20 25.45ns
Specific observer construction + as_dynamic 36.53ns 28.7453 1.27 24.29ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.39ns 0.422513 0.92 0.35ns
Dynamic observer OnNext 2.41ns 1.60829 1.50 2.36ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 50.07ns 33.5029 1.49 80.36ns
Make copy of subscriber 17.81ns 16.0547 1.11 5.54ns
Transform subsriber to dynamic 58.80ns 44.6488 1.32 29.36ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 40.54ns 33.5417 1.21 70.24ns
composite_subscription add 55.87ns 51.9188 1.08 99.87ns
composite_subscription unsubscribe 52.53ns 45.5 1.15 26.74ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 342.21ns 237.097 1.44 2406.87ns
sending of values from observable via buffer to subscriber 7.73ns 6.61123 1.17 34.90ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 433.53ns 327.034 1.33 966.95ns
long stateful chain creation + subscribe 512.30ns 451.954 1.13 1760.16ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 1158.08ns 944.586 1.23 .
sending of values from observable via combine_latest to subscriber 34.73ns 33.6949 1.03 .

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 2485.59ns 2039.47 1.22 4908.74ns
concat_with 2540.10ns 2423.75 1.05 5277.59ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 129.87ns 122.134 1.06 443.04ns
sending of values from observable via distinct_until_changed to subscriber 2.94ns 3.22118 0.91 1.24ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 182.91ns 146.734 1.25 929.58ns
sending of values from observable via first to subscriber 0.84ns 1.20636 0.70 0.57ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 82.09ns 68.1741 1.20 976.09ns
error 142.59ns 123.259 1.16 1076.39ns
never 43.25ns 29.1744 1.48 324.35ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 101.10ns 83.2166 1.21 1098.15ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 0.86ns 0.803877 1.07 140.54ns
re-schedule 10 times 21.56ns 18.9685 1.14 167.37ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 93.72ns 71.1152 1.32 893.84ns
just send variadic 127.48ns 94.6111 1.35 1070.91ns

last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
last construction from observable via dot + subscribe 212.84ns 184.304 1.15 525.00ns
sending of values from observable via last to subscriber 3.29ns 1.72703 1.91 1.64ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 101.39ns 78.5757 1.29 517.09ns
sending of values from observable via map to subscriber 0.97ns 1.11608 0.87 1.71ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 2337.94ns 1987.27 1.18 4519.74ns
merge_with 2964.52ns 2373.77 1.25 5842.89ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 562.82ns 490.889 1.15 3361.12ns
sending of values from observable via observe_on to subscriber 67.00ns 72.3766 0.93 291.76ns

on_error_resume_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_error_resume_next construction from observable via dot + subscribe 521.16ns 453.769 1.15 1033.91ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 28.50ns 29.328 0.97 11.33ns
on_error 0.76ns 1.21251 0.63 19.34ns
on_completed 0.75ns 0.80863 0.93 0.74ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 247.29ns 216.2 1.14 195.54ns
get_observable 39.21ns 30.5483 1.28 59.00ns
get_subscriber 58.96ns 64.0132 0.92 28.75ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 5028.60ns 4358.57 1.15 4912.33ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 135.38ns 112.465 1.20 456.34ns
sending of values from observable via scan to subscriber 2.44ns 2.00878 1.21 1.78ns

single-threaded locks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no-lock increment 2.96ns 1.89966 1.56 .
mutex lock increment 21.87ns 36.5937 0.60 .
spin-lock increment 14.89ns 10.426 1.43 .

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 143.28ns 112.7 1.27 702.63ns
sending of values from observable via skip to subscriber 3.49ns 3.2337 1.08 2.27ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 3154.35ns 2442.58 1.29 6029.37ns
sending of values from observable via switch_on_next to subscriber 631.23ns 629.106 1.00 1451.09ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 306.55ns 176.43 1.74 714.85ns
sending of values from observable via take to subscriber 4.19ns 4.04918 1.04 3.56ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 270.55ns 210.54 1.29 775.65ns
sending of values from observable via take_last to subscriber 3.82ns 2.76611 1.38 6.69ns

take_until

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_until construction from observable via dot + subscribe 1527.49ns 1099.96 1.39 1978.25ns
sending of values from observable via take_until to subscriber 12.87ns 10.4377 1.23 2.35ns

timeout

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
timeout construction from observable via dot + subscribe with run_loop 1502.34ns 1156.45 1.30 10015.20ns
sending of values from observable via timeout to subscriber with unreachable timeout interval with run_loop 94.85ns 62.7198 1.51 11231.50ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 26.89ns 20.2618 1.33 224.94ns
re-schedule 10 times 55.32ns 44.2406 1.25 247.49ns
recursively schedule 10 times 1933.96ns 1405.19 1.38 8924.80ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 2319.55ns 2193.57 1.06 4586.46ns
sending of values from observable via window to subscriber 659.39ns 600.898 1.10 569.77ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 1473.43ns 1128.46 1.31 .
sending of values from observable via with_latest_from to subscriber 44.44ns 31.7546 1.40 .

ci-windows

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 2.01ns 1.81506 1.11 0.41ns
Dynamic observable construction 73.01ns 111.094 0.66 115.50ns
Specific observable construction + as_dynamic 74.74ns 97.9837 0.76 115.68ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 135.19ns 176.791 0.76 1173.09ns
Specific observable lift dynamic observer 169.30ns 299.354 0.57 1235.38ns
Dynamic observable lift specific observer 267.09ns 340.478 0.78 1372.47ns
Dynamic observable lift dynamic observer 234.78ns 282.841 0.83 1271.00ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 98.45ns 132.939 0.74 1128.36ns
Specific observable subscribe dynamic observer 117.39ns 156.284 0.75 1164.55ns
Dynamic observable subscribe specific observer 206.01ns 274.637 0.75 1311.37ns
Dynamic observable subscribe dynamic observer 169.94ns 220.569 0.77 1212.14ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 98.60ns 134.882 0.73 1145.00ns
Dynamic observable subscribe lambda 208.10ns 275.768 0.75 1297.40ns
Specific observable subscribe lambda without subscription 98.92ns 134.132 0.74 1142.91ns
Dynamic observable subscribe lambda without subscription 206.64ns 284.46 0.73 1317.05ns
Specific observable subscribe specific subscriber 26.89ns 36.6311 0.73 850.23ns
Dynamic observable subscribe specific subscriber 134.08ns 177.798 0.75 1019.80ns
Specific observable subscribe dynamic observer 26.89ns 36.6094 0.73 870.93ns
Dynamic observable subscribe dynamic observer 80.44ns 98.5796 0.82 951.63ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 2.00ns 1.80449 1.11 2.01ns
Dynamic observer construction 74.07ns 99.7185 0.74 108.20ns
Specific observer construction + as_dynamic 74.07ns 100.034 0.74 108.01ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.80ns 0.803065 1.00 0.80ns
Dynamic observer OnNext 1.63ns 2.01359 0.81 1.60ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 72.28ns 100.839 0.72 323.44ns
Make copy of subscriber 16.05ns 20.0555 0.80 34.69ns
Transform subsriber to dynamic 87.76ns 116.929 0.75 143.67ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 94.75ns 100.889 0.94 321.91ns
composite_subscription add 73.33ns 84.4586 0.87 172.56ns
composite_subscription unsubscribe 64.59ns 124.351 0.52 118.29ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 339.84ns 428.493 0.79 4399.50ns
sending of values from observable via buffer to subscriber 6.86ns 8.36743 0.82 87.20ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 295.12ns 319.012 0.93 1704.47ns
long stateful chain creation + subscribe 637.08ns 791.028 0.81 3258.14ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 1549.00ns 1979.47 0.78 .
sending of values from observable via combine_latest to subscriber 46.94ns 57.2744 0.82 .

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 2670.30ns 3321.89 0.80 10670.30ns
concat_with 3367.00ns 4107.88 0.82 11633.00ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 172.06ns 220.059 0.78 1020.76ns
sending of values from observable via distinct_until_changed to subscriber 3.33ns 5.52271 0.60 3.61ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 141.76ns 153.236 0.93 2617.20ns
sending of values from observable via first to subscriber 2.40ns 2.81475 0.85 1.23ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 64.05ns 76.0759 0.84 2369.00ns
error 119.15ns 135.663 0.88 2513.10ns
never 28.40ns 38.5048 0.74 886.18ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 122.80ns 162.183 0.76 2445.90ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 1.68ns 2.4114 0.70 411.36ns
re-schedule 10 times 130.16ns 117.427 1.11 441.19ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 65.61ns 78.9722 0.83 2373.82ns
just send variadic 98.91ns 125.673 0.79 2461.00ns

last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
last construction from observable via dot + subscribe 225.74ns 265.275 0.85 1440.41ns
sending of values from observable via last to subscriber 3.12ns 3.83523 0.81 3.33ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 95.19ns 106.32 0.90 980.96ns
sending of values from observable via map to subscriber 3.54ns 4.81923 0.73 7.15ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 2600.80ns 3241.1 0.80 11046.70ns
merge_with 3302.12ns 4003.75 0.82 11654.70ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 613.60ns 747.474 0.82 5817.40ns
sending of values from observable via observe_on to subscriber 61.67ns 82.7074 0.75 774.69ns

on_error_resume_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_error_resume_next construction from observable via dot + subscribe 617.72ns 762.975 0.81 1902.08ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 22.48ns 24.4964 0.92 28.56ns
on_error 2.86ns 3.65481 0.78 19.82ns
on_completed 2.93ns 3.64565 0.80 0.82ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 332.11ns 429.824 0.77 630.41ns
get_observable 31.22ns 34.5447 0.90 155.04ns
get_subscriber 61.47ns 60.2407 1.02 99.70ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 5855.40ns 7833.0 0.75 11154.00ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 170.48ns 225.75 0.76 1265.75ns
sending of values from observable via scan to subscriber 5.32ns 7.22499 0.74 8.33ns

single-threaded locks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no-lock increment 3.09ns 2.2576 1.37 .
mutex lock increment 26.08ns 31.0758 0.84 .
spin-lock increment 10.43ns 10.8513 0.96 .

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 173.46ns 208.924 0.83 1553.93ns
sending of values from observable via skip to subscriber 3.34ns 4.08183 0.82 3.46ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 3396.88ns 4270.57 0.80 11977.50ns
sending of values from observable via switch_on_next to subscriber 839.27ns 1023.62 0.82 3216.89ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 229.56ns 269.42 0.85 2152.00ns
sending of values from observable via take to subscriber 6.22ns 6.71063 0.93 5.69ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 329.81ns 389.219 0.85 2403.55ns
sending of values from observable via take_last to subscriber 4.14ns 5.30824 0.78 19.62ns

take_until

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_until construction from observable via dot + subscribe 1509.06ns 1905.94 0.79 5194.60ns
sending of values from observable via take_until to subscriber 12.15ns 13.7851 0.88 5.23ns

timeout

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
timeout construction from observable via dot + subscribe with run_loop 1666.77ns 1951.23 0.85 5589.25ns
sending of values from observable via timeout to subscriber with unreachable timeout interval with run_loop 57.55ns 65.1962 0.88 1394.12ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 18.98ns 24.7802 0.77 592.98ns
re-schedule 10 times 143.09ns 146.427 0.98 634.38ns
recursively schedule 10 times 2439.73ns 3261.8 0.75 19240.50ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 3226.11ns 3518.89 0.92 9537.67ns
sending of values from observable via window to subscriber 817.19ns 1007.71 0.81 1572.25ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 1823.00ns 2404.42 0.76 .
sending of values from observable via with_latest_from to subscriber 36.47ns 45.3145 0.80 .

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ clang-tidy found issue(s) with the introduced code (1/1)

publish_strategy(const composite_subscription& sub)
: m_sub{sub}
template<rpp::constraint::decayed_same_as<composite_subscription> TSub>
publish_strategy(TSub&& sub)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ bugprone-forwarding-reference-overload ⚠️
constructor accepting a forwarding reference can hide the copy and move constructors

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 5, 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 11 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@victimsnino victimsnino merged commit 8c6431e into main Dec 5, 2022
@victimsnino victimsnino deleted the behavior_subject branch December 5, 2022 06:54
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.

1 participant