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 debounce operator #308

Merged
merged 8 commits into from
Dec 11, 2022
Merged

Add debounce operator #308

merged 8 commits into from
Dec 11, 2022

Conversation

victimsnino
Copy link
Owner

Resolves #306

@codecov
Copy link

codecov bot commented Dec 11, 2022

Codecov Report

Merging #308 (5371122) into main (65decf7) will decrease coverage by 0.22%.
The diff coverage is 92.75%.

@@            Coverage Diff             @@
##             main     #308      +/-   ##
==========================================
- Coverage   98.09%   97.87%   -0.23%     
==========================================
  Files         110      112       +2     
  Lines        1631     1694      +63     
==========================================
+ Hits         1600     1658      +58     
- Misses         31       36       +5     
Impacted Files Coverage Δ
src/rpp/rpp/observables/interface_observable.hpp 100.00% <ø> (ø)
src/rpp/rpp/operators/debounce.hpp 90.56% <90.56%> (ø)
...pp/rpp/operators/details/serialized_subscriber.hpp 100.00% <100.00%> (ø)
src/rpp/rpp/operators/fwd/debounce.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

BENCHMARK RESULTS (AUTOGENERATED)

ci-macos

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 0.29ns 0.295272 0.99 0.29ns
Dynamic observable construction 85.44ns 72.8599 1.17 115.37ns
Specific observable construction + as_dynamic 74.66ns 75.2661 0.99 110.11ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 144.37ns 136.705 1.06 1147.14ns
Specific observable lift dynamic observer 163.66ns 165.044 0.99 1186.02ns
Dynamic observable lift specific observer 252.17ns 307.656 0.82 1334.51ns
Dynamic observable lift dynamic observer 211.79ns 220.05 0.96 1188.85ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 144.91ns 109.193 1.33 1139.69ns
Specific observable subscribe dynamic observer 179.76ns 138.726 1.30 1507.78ns
Dynamic observable subscribe specific observer 225.98ns 210.874 1.07 1266.80ns
Dynamic observable subscribe dynamic observer 173.14ns 170.226 1.02 1431.08ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 150.87ns 115.993 1.30 1113.02ns
Dynamic observable subscribe lambda 265.06ns 262.053 1.01 1333.32ns
Specific observable subscribe lambda without subscription 128.22ns 114.538 1.12 1137.73ns
Dynamic observable subscribe lambda without subscription 226.68ns 242.048 0.94 1296.55ns
Specific observable subscribe specific subscriber 45.68ns 31.6136 1.44 820.55ns
Dynamic observable subscribe specific subscriber 150.93ns 130.7 1.15 948.41ns
Specific observable subscribe dynamic observer 46.86ns 32.1715 1.46 846.71ns
Dynamic observable subscribe dynamic observer 82.19ns 73.0246 1.13 904.23ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 0.29ns 0.282464 1.01 0.28ns
Dynamic observer construction 77.13ns 78.1441 0.99 108.62ns
Specific observer construction + as_dynamic 73.02ns 68.922 1.06 107.75ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.91ns 0.810509 1.12 0.82ns
Dynamic observer OnNext 2.51ns 8.10672 0.31 2.53ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 74.85ns 77.3891 0.97 335.42ns
Make copy of subscriber 12.69ns 12.4243 1.02 29.53ns
Transform subsriber to dynamic 102.08ns 103.707 0.98 138.69ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 77.64ns 78.5865 0.99 294.16ns
composite_subscription add 57.39ns 142.809 0.40 117.70ns
composite_subscription unsubscribe 92.68ns 252.224 0.37 86.82ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 346.85ns 328.329 1.06 3990.68ns
sending of values from observable via buffer to subscriber 6.25ns 5.88329 1.06 89.14ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 215.00ns 220.511 0.98 1322.29ns
long stateful chain creation + subscribe 547.39ns 523.963 1.04 2916.30ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 1438.60ns 1327.52 1.08 .
sending of values from observable via combine_latest to subscriber 29.77ns 28.9968 1.03 .

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 2863.05ns 2716.41 1.05 11959.90ns
concat_with 3254.08ns 3180.85 1.02 11335.50ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 183.86ns 167.01 1.10 1036.58ns
sending of values from observable via distinct_until_changed to subscriber 2.88ns 2.25401 1.28 1.29ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 130.86ns 123.695 1.06 2176.17ns
sending of values from observable via first to subscriber 0.87ns 0.90972 0.95 0.90ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 66.49ns 175.914 0.38 2785.08ns
error 113.70ns 240.847 0.47 2751.13ns
never 45.22ns 32.6285 1.39 1051.14ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 172.65ns 138.464 1.25 2481.63ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 2.02ns 2.03801 0.99 413.57ns
re-schedule 10 times 26.24ns 26.1694 1.00 418.40ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 67.90ns 65.7713 1.03 2975.04ns
just send variadic 104.35ns 95.4321 1.09 2622.78ns

last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
last construction from observable via dot + subscribe 227.33ns 215.052 1.06 1211.66ns
sending of values from observable via last to subscriber 2.60ns 2.50984 1.04 1.30ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 74.70ns 66.8282 1.12 1170.71ns
sending of values from observable via map to subscriber 1.16ns 1.11292 1.04 1.63ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 2932.07ns 2586.42 1.13 11731.10ns
merge_with 3257.30ns 3170.96 1.03 12768.20ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 1387.07ns 1263.14 1.10 14859.90ns
sending of values from observable via observe_on to subscriber 221.10ns 216.411 1.02 916.83ns

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 572.45ns 586.266 0.98 1549.51ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 21.61ns 49.8083 0.43 29.20ns
on_error 0.56ns 1.68262 0.33 18.27ns
on_completed 0.61ns 0.584023 1.04 2.37ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 338.71ns 424.262 0.80 623.48ns
get_observable 27.24ns 26.5423 1.03 159.30ns
get_subscriber 50.71ns 53.3998 0.95 80.46ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 6570.17ns 9565.71 0.69 10399.40ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 155.38ns 137.905 1.13 1155.24ns
sending of values from observable via scan to subscriber 2.74ns 2.41721 1.13 2.43ns

single-threaded locks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no-lock increment 1.82ns 1.82177 1.00 .
mutex lock increment 27.25ns 24.2221 1.12 .
spin-lock increment 8.60ns 8.41011 1.02 .

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 171.41ns 141.084 1.21 1437.46ns
sending of values from observable via skip to subscriber 2.32ns 2.23848 1.04 1.97ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 3759.34ns 3620.72 1.04 10848.00ns
sending of values from observable via switch_on_next to subscriber 845.23ns 835.099 1.01 2776.80ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 259.62ns 191.295 1.36 1852.21ns
sending of values from observable via take to subscriber 3.16ns 2.75184 1.15 6.58ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 355.95ns 312.819 1.14 2375.85ns
sending of values from observable via take_last to subscriber 2.76ns 2.71013 1.02 5.49ns

take_until

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_until construction from observable via dot + subscribe 1551.47ns 1511.88 1.03 5051.82ns
sending of values from observable via take_until to subscriber 8.41ns 7.85548 1.07 2.53ns

timeout

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
timeout construction from observable via dot + subscribe with run_loop 6411.26ns 6250.58 1.03 4884.56ns
sending of values from observable via timeout to subscriber with unreachable timeout interval with run_loop 77.62ns 67.494 1.15 1002.83ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 45.14ns 31.7878 1.42 635.37ns
re-schedule 10 times 114.44ns 103.376 1.11 642.05ns
recursively schedule 10 times 2689.83ns 2011.61 1.34 16480.80ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 3095.05ns 2980.99 1.04 9500.18ns
sending of values from observable via window to subscriber 1568.20ns 833.422 1.88 1649.42ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 1697.15ns 1745.01 0.97 .
sending of values from observable via with_latest_from to subscriber 32.71ns 31.9888 1.02 .

ci-ubuntu-clang

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 0.34ns 0.387798 0.87 0.34ns
Dynamic observable construction 18.72ns 21.5821 0.87 30.68ns
Specific observable construction + as_dynamic 17.92ns 20.6656 0.87 30.69ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 50.35ns 59.6251 0.84 326.76ns
Specific observable lift dynamic observer 51.11ns 57.5451 0.89 348.17ns
Dynamic observable lift specific observer 84.39ns 87.9876 0.96 376.97ns
Dynamic observable lift dynamic observer 74.81ns 91.8267 0.81 360.59ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 36.46ns 44.4264 0.82 321.08ns
Specific observable subscribe dynamic observer 37.31ns 40.8479 0.91 334.89ns
Dynamic observable subscribe specific observer 70.43ns 85.7699 0.82 364.36ns
Dynamic observable subscribe dynamic observer 59.94ns 70.6644 0.85 348.59ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 36.63ns 36.3477 1.01 324.70ns
Dynamic observable subscribe lambda 65.93ns 76.3632 0.86 366.02ns
Specific observable subscribe lambda without subscription 36.61ns 44.4879 0.82 323.74ns
Dynamic observable subscribe lambda without subscription 64.63ns 83.4701 0.77 368.35ns
Specific observable subscribe specific subscriber 13.74ns 15.1696 0.91 259.34ns
Dynamic observable subscribe specific subscriber 42.76ns 50.2827 0.85 300.18ns
Specific observable subscribe dynamic observer 13.76ns 15.7943 0.87 269.14ns
Dynamic observable subscribe dynamic observer 33.63ns 36.6478 0.92 285.10ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 0.33ns 0.412926 0.81 0.34ns
Dynamic observer construction 18.18ns 22.7003 0.80 23.63ns
Specific observer construction + as_dynamic 17.59ns 23.3293 0.75 23.71ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.67ns 0.749177 0.89 0.67ns
Dynamic observer OnNext 1.68ns 2.13082 0.79 2.35ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 19.84ns 20.9142 0.95 68.49ns
Make copy of subscriber 6.97ns 8.07919 0.86 8.12ns
Transform subsriber to dynamic 19.92ns 21.6508 0.92 28.03ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 19.75ns 23.839 0.83 60.81ns
composite_subscription add 18.04ns 23.6174 0.76 92.22ns
composite_subscription unsubscribe 30.34ns 37.4839 0.81 29.88ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 152.84ns 175.908 0.87 1816.22ns
sending of values from observable via buffer to subscriber 6.69ns 5.71198 1.17 25.76ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 102.55ns 107.618 0.95 583.51ns
long stateful chain creation + subscribe 145.06ns 171.206 0.85 1710.99ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 455.54ns 525.28 0.87 .
sending of values from observable via combine_latest to subscriber 13.78ns 20.3978 0.68 .

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 1055.61ns 1259.89 0.84 3577.53ns
concat_with 1181.26ns 1573.0 0.75 3906.34ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 51.60ns 62.0463 0.83 305.32ns
sending of values from observable via distinct_until_changed to subscriber 2.01ns 2.53614 0.79 1.17ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 62.13ns 72.676 0.85 691.15ns
sending of values from observable via first to subscriber 1.01ns 0.618385 1.63 1.01ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 36.34ns 41.5757 0.87 696.43ns
error 81.05ns 96.1963 0.84 772.10ns
never 14.46ns 16.1945 0.89 272.53ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 48.02ns 52.9184 0.91 725.97ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 1.34ns 0.78047 1.72 122.81ns
re-schedule 10 times 7.77ns 9.67328 0.80 153.99ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 38.56ns 46.8008 0.82 693.64ns
just send variadic 70.22ns 72.4275 0.97 768.43ns

last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
last construction from observable via dot + subscribe 88.24ns 108.682 0.81 422.48ns
sending of values from observable via last to subscriber 2.03ns 2.88829 0.70 1.34ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 30.42ns 38.2311 0.80 287.41ns
sending of values from observable via map to subscriber 1.34ns 1.05218 1.27 2.01ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 1002.84ns 1235.75 0.81 3525.07ns
merge_with 1127.89ns 1399.96 0.81 3877.46ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 569.47ns 807.96 0.70 2794.70ns
sending of values from observable via observe_on to subscriber 126.16ns 119.149 1.06 240.02ns

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 232.31ns 271.159 0.86 1016.55ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 19.14ns 23.3735 0.82 14.86ns
on_error 0.67ns 0.829669 0.81 16.85ns
on_completed 0.68ns 0.850685 0.79 0.67ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 123.26ns 188.295 0.65 179.07ns
get_observable 7.90ns 8.16656 0.97 51.23ns
get_subscriber 19.71ns 21.1205 0.93 19.81ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 2183.64ns 3056.55 0.71 3253.67ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 46.20ns 61.808 0.75 373.68ns
sending of values from observable via scan to subscriber 2.01ns 2.39606 0.84 2.35ns

single-threaded locks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no-lock increment 2.02ns 2.83855 0.71 .
mutex lock increment 8.04ns 7.64279 1.05 .
spin-lock increment 9.24ns 12.4445 0.74 .

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 45.69ns 52.3381 0.87 529.08ns
sending of values from observable via skip to subscriber 2.01ns 2.52146 0.80 1.80ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 1202.22ns 1481.76 0.81 3518.58ns
sending of values from observable via switch_on_next to subscriber 300.92ns 414.381 0.73 821.07ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 82.48ns 97.5088 0.85 572.11ns
sending of values from observable via take to subscriber 2.35ns 2.35014 1.00 2.69ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 115.57ns 122.972 0.94 616.27ns
sending of values from observable via take_last to subscriber 2.36ns 2.83515 0.83 4.09ns

take_until

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_until construction from observable via dot + subscribe 584.94ns 643.827 0.91 1410.53ns
sending of values from observable via take_until to subscriber 8.77ns 12.6912 0.69 2.35ns

timeout

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
timeout construction from observable via dot + subscribe with run_loop 814.95ns 949.172 0.86 17080.90ns
sending of values from observable via timeout to subscriber with unreachable timeout interval with run_loop 41.51ns 47.0073 0.88 16656.30ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 8.79ns 8.72717 1.01 182.19ns
re-schedule 10 times 28.17ns 26.636 1.06 217.85ns
recursively schedule 10 times 1451.94ns 1962.8 0.74 8112.78ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 1002.83ns 1166.51 0.86 3337.68ns
sending of values from observable via window to subscriber 266.52ns 289.31 0.92 417.26ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 534.91ns 1298.71 0.41 .
sending of values from observable via with_latest_from to subscriber 14.68ns 15.8332 0.93 .

ci-ubuntu-gcc

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 0.33ns 0.334817 1.00 0.33ns
Dynamic observable construction 32.55ns 32.5312 1.00 51.82ns
Specific observable construction + as_dynamic 32.48ns 32.4643 1.00 51.85ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 98.83ns 98.7297 1.00 727.40ns
Specific observable lift dynamic observer 128.48ns 128.146 1.00 778.12ns
Dynamic observable lift specific observer 183.65ns 183.649 1.00 834.66ns
Dynamic observable lift dynamic observer 200.43ns 195.291 1.03 814.26ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 61.76ns 61.8396 1.00 698.18ns
Specific observable subscribe dynamic observer 80.09ns 80.1545 1.00 731.45ns
Dynamic observable subscribe specific observer 132.22ns 132.352 1.00 792.30ns
Dynamic observable subscribe dynamic observer 130.46ns 128.294 1.02 740.60ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 61.78ns 61.9769 1.00 707.78ns
Dynamic observable subscribe lambda 132.63ns 132.718 1.00 782.96ns
Specific observable subscribe lambda without subscription 61.81ns 61.7254 1.00 727.71ns
Dynamic observable subscribe lambda without subscription 132.76ns 132.656 1.00 815.46ns
Specific observable subscribe specific subscriber 30.42ns 30.438 1.00 597.99ns
Dynamic observable subscribe specific subscriber 99.21ns 99.4321 1.00 687.69ns
Specific observable subscribe dynamic observer 30.46ns 30.4971 1.00 628.28ns
Dynamic observable subscribe dynamic observer 84.99ns 85.1983 1.00 633.44ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 0.33ns 0.335176 1.00 0.33ns
Dynamic observer construction 32.86ns 32.4581 1.01 45.24ns
Specific observer construction + as_dynamic 32.52ns 32.5578 1.00 47.56ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.33ns 0.334796 1.00 0.33ns
Dynamic observer OnNext 1.68ns 1.67619 1.00 2.01ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 35.54ns 35.5601 1.00 135.54ns
Make copy of subscriber 16.71ns 16.7338 1.00 31.76ns
Transform subsriber to dynamic 46.54ns 47.163 0.99 78.18ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 35.55ns 35.5966 1.00 128.89ns
composite_subscription add 49.44ns 49.4718 1.00 115.67ns
composite_subscription unsubscribe 43.34ns 43.3086 1.00 38.36ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 236.96ns 237.042 1.00 2936.97ns
sending of values from observable via buffer to subscriber 6.36ns 6.36636 1.00 30.62ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 288.19ns 287.885 1.00 1370.71ns
long stateful chain creation + subscribe 429.30ns 429.67 1.00 4664.50ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 840.96ns 842.85 1.00 .
sending of values from observable via combine_latest to subscriber 15.71ns 15.7424 1.00 .

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 1878.66ns 1897.7 0.99 7569.15ns
concat_with 2236.90ns 2254.37 0.99 8083.66ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 120.95ns 121.401 1.00 735.48ns
sending of values from observable via distinct_until_changed to subscriber 2.67ns 2.69457 0.99 1.34ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 137.61ns 137.759 1.00 1671.37ns
sending of values from observable via first to subscriber 1.00ns 1.00778 1.00 1.01ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 67.90ns 67.8226 1.00 1728.65ns
error 117.57ns 117.997 1.00 1752.96ns
never 32.49ns 32.4796 1.00 627.60ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 87.36ns 87.416 1.00 1755.80ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 1.34ns 1.34423 1.00 277.45ns
re-schedule 10 times 22.45ns 22.446 1.00 307.78ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 70.69ns 70.4034 1.00 1746.39ns
just send variadic 111.89ns 112.599 0.99 1786.74ns

last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
last construction from observable via dot + subscribe 176.93ns 176.325 1.00 1014.15ns
sending of values from observable via last to subscriber 2.07ns 2.07191 1.00 1.34ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 82.03ns 82.0975 1.00 728.18ns
sending of values from observable via map to subscriber 1.34ns 1.33811 1.00 2.67ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 1839.04ns 1838.78 1.00 9178.43ns
merge_with 2182.62ns 2180.66 1.00 8957.93ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 833.07ns 811.976 1.03 3325.73ns
sending of values from observable via observe_on to subscriber 160.07ns 159.571 1.00 517.48ns

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 440.77ns 440.248 1.00 1468.76ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 22.39ns 22.4054 1.00 15.95ns
on_error 1.01ns 1.01056 1.00 16.86ns
on_completed 1.35ns 1.34689 1.00 0.67ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 210.33ns 214.152 0.98 376.67ns
get_observable 29.54ns 29.4997 1.00 97.75ns
get_subscriber 57.43ns 57.4887 1.00 95.34ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 4166.83ns 4172.65 1.00 7156.33ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 117.16ns 117.044 1.00 894.58ns
sending of values from observable via scan to subscriber 2.01ns 2.01243 1.00 1.59ns

single-threaded locks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no-lock increment 2.01ns 2.00972 1.00 .
mutex lock increment 7.72ns 7.73175 1.00 .
spin-lock increment 9.03ns 9.04921 1.00 .

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 114.21ns 114.319 1.00 1102.42ns
sending of values from observable via skip to subscriber 2.38ns 2.38931 1.00 2.34ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 2319.66ns 2330.94 1.00 10660.90ns
sending of values from observable via switch_on_next to subscriber 598.41ns 598.985 1.00 2960.97ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 175.41ns 175.278 1.00 1381.07ns
sending of values from observable via take to subscriber 3.51ns 3.50292 1.00 4.04ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 209.21ns 208.766 1.00 1405.39ns
sending of values from observable via take_last to subscriber 3.38ns 3.37785 1.00 5.89ns

take_until

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_until construction from observable via dot + subscribe 1078.56ns 1073.19 1.01 3519.40ns
sending of values from observable via take_until to subscriber 9.02ns 9.82894 0.92 1.84ns

timeout

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
timeout construction from observable via dot + subscribe with run_loop 1106.31ns 1112.52 0.99 17660.40ns
sending of values from observable via timeout to subscriber with unreachable timeout interval with run_loop 60.64ns 60.5587 1.00 2722.26ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 22.38ns 22.6069 0.99 367.77ns
re-schedule 10 times 50.46ns 50.5088 1.00 398.24ns
recursively schedule 10 times 1466.79ns 1421.2 1.03 19675.40ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 2008.51ns 2013.68 1.00 6027.12ns
sending of values from observable via window to subscriber 546.28ns 546.193 1.00 964.05ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 1040.98ns 1043.57 1.00 .
sending of values from observable via with_latest_from to subscriber 15.39ns 15.373 1.00 .

ci-windows

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 1.33ns 1.50375 0.88 0.60ns
Dynamic observable construction 71.57ns 93.6559 0.76 107.55ns
Specific observable construction + as_dynamic 71.46ns 81.209 0.88 109.10ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 129.13ns 145.789 0.89 1098.86ns
Specific observable lift dynamic observer 157.64ns 177.2 0.89 1123.62ns
Dynamic observable lift specific observer 255.04ns 284.596 0.90 1239.84ns
Dynamic observable lift dynamic observer 209.05ns 237.046 0.88 1157.10ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 100.24ns 110.262 0.91 1038.13ns
Specific observable subscribe dynamic observer 116.43ns 129.919 0.90 1073.45ns
Dynamic observable subscribe specific observer 204.30ns 228.694 0.89 1195.05ns
Dynamic observable subscribe dynamic observer 169.32ns 178.986 0.95 1131.95ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 99.67ns 116.771 0.85 1030.78ns
Dynamic observable subscribe lambda 203.65ns 229.243 0.89 1191.30ns
Specific observable subscribe lambda without subscription 99.83ns 114.895 0.87 1032.04ns
Dynamic observable subscribe lambda without subscription 204.43ns 231.554 0.88 1175.85ns
Specific observable subscribe specific subscriber 27.19ns 30.5084 0.89 742.81ns
Dynamic observable subscribe specific subscriber 129.90ns 148.705 0.87 1331.54ns
Specific observable subscribe dynamic observer 27.36ns 30.562 0.90 785.83ns
Dynamic observable subscribe dynamic observer 69.27ns 79.2562 0.87 812.00ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 1.33ns 1.50537 0.88 1.33ns
Dynamic observer construction 73.05ns 83.0814 0.88 99.59ns
Specific observer construction + as_dynamic 73.41ns 83.2039 0.88 99.67ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.59ns 0.799577 0.74 0.59ns
Dynamic observer OnNext 1.64ns 1.67733 0.98 1.51ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 76.14ns 83.9046 0.91 319.71ns
Make copy of subscriber 25.04ns 17.4011 1.44 27.74ns
Transform subsriber to dynamic 86.30ns 97.5096 0.89 132.49ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 76.52ns 84.4455 0.91 303.82ns
composite_subscription add 63.00ns 71.5161 0.88 134.58ns
composite_subscription unsubscribe 57.36ns 64.8321 0.88 144.47ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 312.73ns 352.985 0.89 3961.67ns
sending of values from observable via buffer to subscriber 5.69ns 6.78443 0.84 79.94ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 240.17ns 269.829 0.89 1523.80ns
long stateful chain creation + subscribe 581.31ns 659.889 0.88 2802.62ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 1416.93ns 1783.43 0.79 .
sending of values from observable via combine_latest to subscriber 41.64ns 47.3104 0.88 .

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 4458.44ns 2721.9 1.64 9471.00ns
concat_with 3016.50ns 4686.38 0.64 10371.00ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 161.50ns 186.699 0.87 912.12ns
sending of values from observable via distinct_until_changed to subscriber 2.97ns 3.50851 0.85 3.73ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 113.22ns 128.214 0.88 2334.40ns
sending of values from observable via first to subscriber 2.07ns 2.34386 0.88 1.56ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 57.01ns 62.7754 0.91 2111.73ns
error 99.20ns 113.174 0.88 2200.55ns
never 27.15ns 31.0083 0.88 787.83ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 124.74ns 134.336 0.93 2182.27ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 1.48ns 2.01837 0.74 363.08ns
re-schedule 10 times 86.28ns 97.7701 0.88 392.63ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 60.45ns 66.7011 0.91 2148.27ns
just send variadic 90.08ns 98.3266 0.92 2227.80ns

last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
last construction from observable via dot + subscribe 200.46ns 250.99 0.80 1262.28ns
sending of values from observable via last to subscriber 2.82ns 3.20003 0.88 2.96ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 78.10ns 87.7633 0.89 875.62ns
sending of values from observable via map to subscriber 3.30ns 4.63836 0.71 6.65ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 2350.00ns 2671.2 0.88 9674.33ns
merge_with 2964.75ns 3349.62 0.89 10283.30ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 1050.11ns 1238.86 0.85 5137.80ns
sending of values from observable via observe_on to subscriber 178.94ns 200.562 0.89 706.53ns

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 568.21ns 642.079 0.88 1640.38ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 17.72ns 19.744 0.90 29.23ns
on_error 2.40ns 3.03927 0.79 16.29ns
on_completed 2.03ns 2.70064 0.75 0.60ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 315.60ns 364.254 0.87 524.46ns
get_observable 23.00ns 28.8011 0.80 144.12ns
get_subscriber 44.27ns 50.17 0.88 84.96ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 19030.20ns 6004.6 3.17 10030.00ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 160.16ns 181.708 0.88 1097.95ns
sending of values from observable via scan to subscriber 4.78ns 6.02837 0.79 7.84ns

single-threaded locks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no-lock increment 1.65ns 1.88479 0.88 .
mutex lock increment 22.73ns 26.5445 0.86 .
spin-lock increment 8.01ns 9.03389 0.89 .

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 156.84ns 178.493 0.88 1347.07ns
sending of values from observable via skip to subscriber 2.95ns 4.04858 0.73 3.10ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 3120.71ns 3877.86 0.80 10628.00ns
sending of values from observable via switch_on_next to subscriber 796.20ns 861.167 0.92 2742.89ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 200.91ns 232.281 0.86 1918.42ns
sending of values from observable via take to subscriber 4.47ns 6.35539 0.70 5.75ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 284.49ns 322.686 0.88 2163.18ns
sending of values from observable via take_last to subscriber 3.73ns 4.42668 0.84 18.51ns

take_until

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_until construction from observable via dot + subscribe 1432.44ns 1606.8 0.89 4635.20ns
sending of values from observable via take_until to subscriber 10.42ns 11.3699 0.92 5.08ns

timeout

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
timeout construction from observable via dot + subscribe with run_loop 1495.15ns 1692.15 0.88 5199.75ns
sending of values from observable via timeout to subscriber with unreachable timeout interval with run_loop 49.11ns 54.167 0.91 1581.40ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 16.53ns 21.226 0.78 709.16ns
re-schedule 10 times 165.02ns 121.65 1.36 571.88ns
recursively schedule 10 times 2294.40ns 2627.4 0.87 17110.00ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 2550.56ns 2908.33 0.88 8550.33ns
sending of values from observable via window to subscriber 727.72ns 826.516 0.88 1866.18ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 1770.75ns 2003.25 0.88 .
sending of values from observable via with_latest_from to subscriber 33.96ns 38.1647 0.89 .

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)

schedulers::duration period,
const Scheduler& scheduler,
const composite_subscription& subscription_of_subscriber)
: debounce_state<T, Scheduler>{std::move(period), scheduler, subscription_of_subscriber}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ performance-move-const-arg ⚠️
std::move of the variable period of the trivially-copyable type schedulers::duration (aka duration<long, ratio<1, 1000000000>>) has no effect; remove std::move()

Suggested change
: debounce_state<T, Scheduler>{std::move(period), scheduler, subscription_of_subscriber}
: debounce_state<T, Scheduler>{eriod), scheduler, subscription_of_subscriber}

@sonarqubecloud
Copy link

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 6 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@victimsnino victimsnino merged commit 1ebaa90 into main Dec 11, 2022
@victimsnino victimsnino deleted the debounce branch December 11, 2022 19:13
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.

Implement debounce operator
1 participant