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

Petri net executor example #276

Merged
merged 6 commits into from
Sep 18, 2022

Conversation

thorstink
Copy link
Contributor

As promised, an, imho fun and simplified example of implementing Petri net execution using reactive streams.

Note that it could be a bit fancier by executing the transitions in a different context - that way new transitions would get queued while the active transition is still running. Once RPP has something similar to RxCpp's observe_on_event_loop it would also be straightforward to actually execute transitions parallel using Rx-patterns.

Let me know if you think this example adds value to your project and if there's something you'd like to see clarified/improved.

@codecov
Copy link

codecov bot commented Sep 17, 2022

Codecov Report

Merging #276 (cd15de4) into main (2436824) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #276   +/-   ##
=======================================
  Coverage   98.59%   98.59%           
=======================================
  Files         100      100           
  Lines        1419     1419           
=======================================
  Hits         1399     1399           
  Misses         20       20           

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

@victimsnino
Copy link
Owner

Yeah, looks cool! Thank you!
Could you address comments from CI to pass it? Then i would merge it

@thorstink
Copy link
Contributor Author

thorstink commented Sep 18, 2022 via email

@victimsnino
Copy link
Owner

You need to unfold Build with Cmake inside this one

error:

Error: /home/runner/work/ReactivePlusPlus/ReactivePlusPlus/src/examples/petri/petri.cpp:84:26: error: local variable 'marking' will be copied despite being returned by name [-Werror,-Wreturn-std-move]
[363](https://github.com/victimsnino/ReactivePlusPlus/actions/runs/3074503201/jobs/4967539973#step:5:366)
                    return marking;
[364](https://github.com/victimsnino/ReactivePlusPlus/actions/runs/3074503201/jobs/4967539973#step:5:367)
                           ^~~~~~~

@thorstink
Copy link
Contributor Author

thorstink commented Sep 18, 2022

I was unable to easily reproduce this, clang-14 (which is was I had available) didn't give me this error (with the same flags as in the ci-matrix).. However, I think this edit should fix it.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 18, 2022

BENCHMARK RESULTS (AUTOGENERATED)

ci-ubuntu-clang

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 0.35ns 0.340509 1.02 0.72ns
Dynamic observable construction 24.71ns 32.645 0.76 22.27ns
Specific observable construction + as_dynamic 24.72ns 29.5029 0.84 22.50ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 96.00ns 110.044 0.87 252.63ns
Specific observable lift dynamic observer 120.20ns 169.482 0.71 266.34ns
Dynamic observable lift specific observer 163.72ns 203.335 0.81 292.05ns
Dynamic observable lift dynamic observer 177.26ns 206.288 0.86 286.12ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 64.61ns 74.0421 0.87 247.81ns
Specific observable subscribe dynamic observer 77.80ns 89.8802 0.87 259.25ns
Dynamic observable subscribe specific observer 122.53ns 177.51 0.69 283.46ns
Dynamic observable subscribe dynamic observer 124.22ns 163.351 0.76 275.19ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 63.86ns 90.1229 0.71 249.27ns
Dynamic observable subscribe lambda 118.84ns 179.015 0.66 282.93ns
Specific observable subscribe lambda without subscription 64.48ns 85.3972 0.76 251.83ns
Dynamic observable subscribe lambda without subscription 118.31ns 145.647 0.81 288.62ns
Specific observable subscribe specific subscriber 36.04ns 52.085 0.69 185.39ns
Dynamic observable subscribe specific subscriber 92.58ns 128.037 0.72 225.47ns
Specific observable subscribe dynamic observer 38.08ns 46.1924 0.82 207.02ns
Dynamic observable subscribe dynamic observer 83.62ns 98.6826 0.85 219.48ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 0.35ns 0.365619 0.95 0.35ns
Dynamic observer construction 27.60ns 30.2271 0.91 16.61ns
Specific observer construction + as_dynamic 25.09ns 27.6012 0.91 16.26ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.38ns 0.636688 0.60 0.69ns
Dynamic observer OnNext 1.38ns 1.86267 0.74 1.73ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 29.38ns 40.2961 0.73 58.90ns
Make copy of subscriber 13.89ns 17.7116 0.78 4.31ns
Transform subsriber to dynamic 38.58ns 45.2087 0.85 20.39ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 29.82ns 37.9513 0.79 43.17ns
composite_subscription add 46.28ns 59.9659 0.77 87.47ns
composite_subscription unsubscribe 38.35ns 54.513 0.70 18.86ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 224.81ns 283.662 0.79 1665.62ns
sending of values from observable via buffer to subscriber 6.44ns 6.71574 0.96 20.98ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 255.59ns 283.729 0.90 438.50ns
long stateful chain creation + subscribe 369.62ns 412.116 0.90 739.26ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 800.31ns 1048.18 0.76 767.96ns
sending of values from observable via combine_latest to subscriber 29.58ns 37.5254 0.79 1.46ns

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 1693.53ns 2200.32 0.77 3218.12ns
concat_with 2008.38ns 2719.16 0.74 3533.99ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 113.88ns 130.448 0.87 215.52ns
sending of values from observable via distinct_until_changed to subscriber 2.09ns 3.03336 0.69 1.10ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 132.92ns 166.653 0.80 539.02ns
sending of values from observable via first to subscriber 0.65ns 0.478942 1.36 0.70ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 73.04ns 106.21 0.69 571.89ns
error 116.79ns 134.135 0.87 668.31ns
never 39.34ns 49.9981 0.79 208.34ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 85.20ns 118.84 0.72 601.91ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 0.69ns 0.504601 1.37 98.97ns
re-schedule 10 times 7.08ns 12.4998 0.57 124.71ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 73.34ns 95.6495 0.77 574.44ns
just send variadic 93.45ns 127.711 0.73 660.10ns

last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
last construction from observable via dot + subscribe 164.36ns 213.882 0.77 318.91ns
sending of values from observable via last to subscriber 2.44ns 2.62012 0.93 1.35ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 84.15ns 100.083 0.84 205.90ns
sending of values from observable via map to subscriber 1.04ns 1.02402 1.01 1.50ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 1659.06ns 1998.34 0.83 3150.10ns
merge_with 1971.30ns 2484.87 0.79 3469.85ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 487.89ns 581.975 0.84 2130.99ns
sending of values from observable via observe_on to subscriber 77.94ns 89.5091 0.87 167.26ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 25.56ns 27.1507 0.94 8.35ns
on_error 0.70ns 0.495658 1.41 16.37ns
on_completed 0.70ns 0.526353 1.32 0.52ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 168.97ns 213.776 0.79 140.65ns
get_observable 29.08ns 29.1776 1.00 39.50ns
get_subscriber 57.41ns 61.1882 0.94 10.16ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 3594.42ns 4294.41 0.84 2822.29ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 109.53ns 127.517 0.86 254.23ns
sending of values from observable via scan to subscriber 1.73ns 2.17349 0.80 1.46ns

single-threaded locks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no-lock increment 2.76ns 2.8909 0.95 .
mutex lock increment 19.41ns 21.7447 0.89 .
spin-lock increment 9.01ns 12.6615 0.71 .

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 108.79ns 123.264 0.88 418.77ns
sending of values from observable via skip to subscriber 1.92ns 2.12761 0.90 2.21ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 2021.33ns 2508.72 0.81 2660.62ns
sending of values from observable via switch_on_next to subscriber 521.87ns 794.219 0.66 606.16ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 170.28ns 209.131 0.81 432.78ns
sending of values from observable via take to subscriber 2.31ns 3.18938 0.73 2.15ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 200.19ns 271.302 0.74 469.82ns
sending of values from observable via take_last to subscriber 2.74ns 3.38067 0.81 3.05ns

take_until

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_until construction from observable via dot + subscribe 941.29ns 1122.65 0.84 1118.79ns
sending of values from observable via take_until to subscriber 10.09ns 11.8968 0.85 1.58ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 9.04ns 12.2869 0.74 136.22ns
re-schedule 10 times 23.21ns 26.8016 0.87 168.07ns
recursively schedule 10 times 1265.33ns 1717.4 0.74 4671.49ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 1883.71ns 2221.73 0.85 2842.21ns
sending of values from observable via window to subscriber 505.44ns 648.439 0.78 319.40ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 931.84ns 1528.43 0.61 1028.55ns
sending of values from observable via with_latest_from to subscriber 24.92ns 27.8036 0.90 2.11ns

ci-ubuntu-gcc

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 0.33ns 0.40129 0.82 0.38ns
Dynamic observable construction 30.92ns 28.8132 1.07 23.76ns
Specific observable construction + as_dynamic 31.60ns 28.6537 1.10 25.53ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 134.56ns 117.19 1.15 359.69ns
Specific observable lift dynamic observer 168.21ns 147.715 1.14 409.24ns
Dynamic observable lift specific observer 230.77ns 203.307 1.14 494.70ns
Dynamic observable lift dynamic observer 218.07ns 228.416 0.95 462.28ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 92.18ns 80.0988 1.15 358.96ns
Specific observable subscribe dynamic observer 107.10ns 96.2471 1.11 353.51ns
Dynamic observable subscribe specific observer 177.92ns 149.533 1.19 382.45ns
Dynamic observable subscribe dynamic observer 166.73ns 164.156 1.02 406.46ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 86.68ns 78.8594 1.10 347.94ns
Dynamic observable subscribe lambda 173.29ns 150.407 1.15 385.44ns
Specific observable subscribe lambda without subscription 103.56ns 79.6983 1.30 352.44ns
Dynamic observable subscribe lambda without subscription 175.43ns 150.149 1.17 373.45ns
Specific observable subscribe specific subscriber 50.28ns 48.7035 1.03 312.63ns
Dynamic observable subscribe specific subscriber 128.20ns 117.557 1.09 372.00ns
Specific observable subscribe dynamic observer 53.96ns 49.0835 1.10 293.67ns
Dynamic observable subscribe dynamic observer 115.25ns 103.586 1.11 322.87ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 0.37ns 0.402588 0.93 0.34ns
Dynamic observer construction 32.46ns 28.6374 1.13 20.55ns
Specific observer construction + as_dynamic 29.82ns 29.6567 1.01 20.93ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.35ns 0.43778 0.79 0.32ns
Dynamic observer OnNext 2.16ns 1.60725 1.34 1.95ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 41.07ns 33.6617 1.22 66.25ns
Make copy of subscriber 27.37ns 16.0635 1.70 5.50ns
Transform subsriber to dynamic 48.19ns 44.7073 1.08 25.69ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 38.09ns 33.5112 1.14 59.79ns
composite_subscription add 57.69ns 55.8854 1.03 58.47ns
composite_subscription unsubscribe 43.43ns 43.5177 1.00 25.07ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 281.58ns 256.787 1.10 2052.43ns
sending of values from observable via buffer to subscriber 8.04ns 6.90701 1.16 36.24ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 337.89ns 323.622 1.04 762.05ns
long stateful chain creation + subscribe 478.58ns 455.14 1.05 1289.00ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 1039.96ns 977.819 1.06 1332.58ns
sending of values from observable via combine_latest to subscriber 40.93ns 34.1705 1.20 1.87ns

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 2062.72ns 2040.87 1.01 4625.88ns
concat_with 2860.55ns 2419.76 1.18 4380.86ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 152.62ns 141.283 1.08 372.60ns
sending of values from observable via distinct_until_changed to subscriber 3.23ns 2.81411 1.15 1.31ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 170.47ns 165.383 1.03 758.24ns
sending of values from observable via first to subscriber 0.66ns 1.6125 0.41 0.50ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 115.99ns 85.8394 1.35 887.33ns
error 158.50ns 135.324 1.17 865.23ns
never 55.92ns 46.3469 1.21 331.58ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 124.25ns 101.376 1.23 962.55ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 1.04ns 1.19138 0.87 144.68ns
re-schedule 10 times 18.72ns 20.0391 0.93 174.72ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 100.60ns 89.1861 1.13 971.36ns
just send variadic 135.70ns 115.207 1.18 885.50ns

last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
last construction from observable via dot + subscribe 201.16ns 200.639 1.00 537.06ns
sending of values from observable via last to subscriber 3.45ns 3.2372 1.06 1.48ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 137.30ns 109.77 1.25 392.85ns
sending of values from observable via map to subscriber 0.97ns 1.00269 0.97 1.87ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 2266.50ns 2000.61 1.13 4014.29ns
merge_with 2345.67ns 2365.47 0.99 4459.72ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 570.64ns 608.635 0.94 3197.91ns
sending of values from observable via observe_on to subscriber 94.88ns 94.9183 1.00 296.51ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 25.32ns 29.4082 0.86 11.19ns
on_error 0.75ns 0.809906 0.93 19.98ns
on_completed 0.68ns 1.21132 0.56 0.73ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 194.34ns 215.209 0.90 189.13ns
get_observable 30.63ns 30.5525 1.00 50.65ns
get_subscriber 61.03ns 64.2136 0.95 23.57ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 5020.29ns 4358.99 1.15 3481.01ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 166.00ns 136.039 1.22 411.49ns
sending of values from observable via scan to subscriber 2.86ns 2.41092 1.19 1.82ns

single-threaded locks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no-lock increment 2.46ns 2.35245 1.05 .
mutex lock increment 20.09ns 22.5027 0.89 .
spin-lock increment 11.92ns 10.4409 1.14 .

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 176.01ns 134.152 1.31 583.79ns
sending of values from observable via skip to subscriber 4.51ns 3.61726 1.25 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 2458.60ns 2470.16 1.00 4960.84ns
sending of values from observable via switch_on_next to subscriber 666.56ns 626.254 1.06 1266.05ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 204.04ns 192.073 1.06 669.22ns
sending of values from observable via take to subscriber 5.13ns 4.02639 1.27 3.63ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 266.42ns 233.29 1.14 728.60ns
sending of values from observable via take_last to subscriber 3.75ns 3.6265 1.03 6.40ns

take_until

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_until construction from observable via dot + subscribe 1117.46ns 1130.04 0.99 1863.52ns
sending of values from observable via take_until to subscriber 11.43ns 10.4478 1.09 2.16ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 22.19ns 17.5485 1.26 183.31ns
re-schedule 10 times 57.09ns 42.0156 1.36 227.38ns
recursively schedule 10 times 2045.83ns 1387.18 1.47 6904.22ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 2148.42ns 2233.36 0.96 4591.63ns
sending of values from observable via window to subscriber 662.20ns 606.449 1.09 501.04ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 1294.85ns 1131.54 1.14 1451.54ns
sending of values from observable via with_latest_from to subscriber 31.29ns 29.7435 1.05 3.99ns

ci-windows

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 2.00ns 2.00476 1.00 0.81ns
Dynamic observable construction 71.29ns 70.7543 1.01 114.96ns
Specific observable construction + as_dynamic 70.43ns 70.853 0.99 114.69ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 158.37ns 157.532 1.01 1179.00ns
Specific observable lift dynamic observer 188.54ns 191.511 0.98 1229.59ns
Dynamic observable lift specific observer 277.97ns 277.337 1.00 1348.90ns
Dynamic observable lift dynamic observer 255.07ns 254.732 1.00 1257.41ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 122.03ns 120.647 1.01 1393.48ns
Specific observable subscribe dynamic observer 134.79ns 134.568 1.00 1168.00ns
Dynamic observable subscribe specific observer 225.09ns 226.064 1.00 1311.43ns
Dynamic observable subscribe dynamic observer 189.28ns 188.583 1.00 1208.96ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 121.76ns 121.054 1.01 1158.67ns
Dynamic observable subscribe lambda 228.18ns 226.431 1.01 1319.10ns
Specific observable subscribe lambda without subscription 122.40ns 120.52 1.02 1146.57ns
Dynamic observable subscribe lambda without subscription 227.89ns 229.312 0.99 1312.45ns
Specific observable subscribe specific subscriber 45.40ns 52.2894 0.87 861.26ns
Dynamic observable subscribe specific subscriber 155.97ns 150.745 1.03 1021.67ns
Specific observable subscribe dynamic observer 48.47ns 48.6297 1.00 877.69ns
Dynamic observable subscribe dynamic observer 99.96ns 100.276 1.00 912.13ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 2.01ns 2.00646 1.00 2.02ns
Dynamic observer construction 71.52ns 71.2464 1.00 105.58ns
Specific observer construction + as_dynamic 71.38ns 71.1965 1.00 104.36ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.45ns 0.446495 1.00 0.45ns
Dynamic observer OnNext 2.12ns 2.03225 1.04 2.02ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 73.72ns 72.3791 1.02 589.58ns
Make copy of subscriber 16.05ns 16.0681 1.00 37.05ns
Transform subsriber to dynamic 85.98ns 86.3322 1.00 146.98ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 73.46ns 71.9591 1.02 312.46ns
composite_subscription add 75.17ns 68.4014 1.10 171.57ns
composite_subscription unsubscribe 63.84ns 61.1949 1.04 113.19ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 360.36ns 359.078 1.00 4309.29ns
sending of values from observable via buffer to subscriber 6.86ns 6.84343 1.00 84.98ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 311.87ns 335.974 0.93 1730.38ns
long stateful chain creation + subscribe 695.23ns 662.694 1.05 3231.50ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 1592.27ns 1549.53 1.03 3004.25ns
sending of values from observable via combine_latest to subscriber 46.08ns 46.3073 1.00 3.81ns

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 2726.67ns 2768.0 0.99 10839.70ns
concat_with 3983.88ns 3426.12 1.16 11575.70ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 194.47ns 191.341 1.02 1020.48ns
sending of values from observable via distinct_until_changed to subscriber 3.24ns 3.21384 1.01 3.22ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 155.40ns 155.692 1.00 2628.91ns
sending of values from observable via first to subscriber 4.04ns 2.41321 1.68 1.22ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 81.82ns 81.4818 1.00 2355.17ns
error 143.22ns 142.592 1.00 2506.18ns
never 47.04ns 47.1116 1.00 870.63ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 141.51ns 141.06 1.00 2416.55ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 1.62ns 1.61897 1.00 405.91ns
re-schedule 10 times 210.28ns 130.238 1.61 434.55ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 86.56ns 86.1148 1.01 2386.55ns
just send variadic 122.90ns 122.607 1.00 2438.27ns

last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
last construction from observable via dot + subscribe 234.90ns 234.365 1.00 1443.83ns
sending of values from observable via last to subscriber 3.13ns 3.10879 1.01 3.31ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 110.89ns 111.138 1.00 982.25ns
sending of values from observable via map to subscriber 3.55ns 3.55983 1.00 7.47ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 2665.60ns 2743.0 0.97 10990.00ns
merge_with 3403.57ns 3374.62 1.01 11715.70ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 821.53ns 772.094 1.06 5664.40ns
sending of values from observable via observe_on to subscriber 118.62ns 85.3322 1.39 798.18ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 22.59ns 22.6635 1.00 28.39ns
on_error 2.46ns 2.50108 0.98 22.13ns
on_completed 3.01ns 2.8851 1.04 0.81ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 338.69ns 332.237 1.02 608.32ns
get_observable 31.08ns 30.9208 1.01 154.45ns
get_subscriber 109.28ns 61.6717 1.77 100.70ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 5971.60ns 5892.0 1.01 11121.70ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 189.84ns 188.969 1.00 1257.00ns
sending of values from observable via scan to subscriber 5.34ns 5.34572 1.00 8.32ns

single-threaded locks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no-lock increment 2.86ns 3.1275 0.92 .
mutex lock increment 32.68ns 24.5861 1.33 .
spin-lock increment 10.45ns 10.4393 1.00 .

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 192.76ns 184.375 1.05 1562.81ns
sending of values from observable via skip to subscriber 3.22ns 3.21323 1.00 3.36ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 3427.43ns 3437.12 1.00 11950.30ns
sending of values from observable via switch_on_next to subscriber 827.63ns 835.0 0.99 3046.11ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 244.29ns 243.355 1.00 2139.69ns
sending of values from observable via take to subscriber 6.18ns 6.11037 1.01 5.73ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 330.46ns 329.614 1.00 2408.64ns
sending of values from observable via take_last to subscriber 4.21ns 4.22342 1.00 20.47ns

take_until

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_until construction from observable via dot + subscribe 1663.44ns 1663.13 1.00 5169.67ns
sending of values from observable via take_until to subscriber 12.35ns 12.0338 1.03 4.94ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 17.99ns 18.1077 0.99 587.11ns
re-schedule 10 times 143.52ns 143.942 1.00 620.09ns
recursively schedule 10 times 2491.20ns 2460.0 1.01 19429.00ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 4864.56ns 2965.22 1.64 9578.00ns
sending of values from observable via window to subscriber 819.13ns 825.3 0.99 1585.94ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 1887.25ns 1889.08 1.00 3759.17ns
sending of values from observable via with_latest_from to subscriber 37.80ns 43.9731 0.86 6.55ns

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)

src/examples/petri/petri.cpp Outdated Show resolved Hide resolved
src/examples/petri/petri.cpp Outdated Show resolved Hide resolved
victimsnino and others added 2 commits September 18, 2022 17:52
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@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 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@victimsnino victimsnino merged commit b7daaf7 into victimsnino:main Sep 18, 2022
@thorstink
Copy link
Contributor Author

thorstink commented Oct 11, 2022 via email

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