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 tap operator #521

Merged
merged 2 commits into from
Feb 10, 2024
Merged

Add tap operator #521

merged 2 commits into from
Feb 10, 2024

Conversation

CorentinBT
Copy link
Contributor

No description provided.

@CorentinBT CorentinBT marked this pull request as ready for review February 10, 2024 10:51
Copy link
Contributor

github-actions bot commented Feb 10, 2024

BENCHMARK RESULTS (AUTOGENERATED)

ci-ubuntu-gcc

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 300.44 ns 2.16 ns 2.16 ns 1.00
Subscribe empty callbacks to empty observable via pipe operator 301.87 ns 2.16 ns 2.16 ns 1.00

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 687.06 ns 0.31 ns 0.31 ns 1.00
from array of 1 - create + subscribe + current_thread 1032.82 ns 5.24 ns 5.25 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 2266.32 ns 116.22 ns 111.14 ns 1.05
defer from array of 1 - defer + create + subscribe + immediate 797.56 ns 0.31 ns 0.31 ns 1.00
interval - interval + take(3) + subscribe + immediate 2145.37 ns 58.00 ns 58.00 ns 1.00
interval - interval + take(3) + subscribe + current_thread 3107.58 ns 32.10 ns 32.11 ns 1.00

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1072.98 ns 0.31 ns 0.31 ns 1.00
immediate_just+filter(true)+subscribe 842.63 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 987.33 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 848.27 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+first()+subscribe 1272.79 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+last()+subscribe 921.99 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 1102.83 ns 18.82 ns 18.54 ns 1.01

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 261.63 ns 2.16 ns 2.16 ns 1.00
current_thread scheduler create worker + schedule 370.40 ns 7.10 ns 7.10 ns 1.00
current_thread scheduler create worker + schedule + recursive schedule 822.45 ns 63.64 ns 64.51 ns 0.99

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 870.77 ns 0.31 ns 0.31 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 885.17 ns 0.31 ns 0.31 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 2341.82 ns 159.59 ns 200.45 ns 0.80
immediate_just+buffer(2)+subscribe 1590.69 ns 14.50 ns 14.20 ns 1.02
immediate_just+window(2)+subscribe + subscsribe inner 2353.30 ns 971.94 ns 1034.64 ns 0.94

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 832.29 ns - - 0.00
immediate_just+take_while(true)+subscribe 906.55 ns 0.31 ns 0.31 ns 1.00

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 1990.50 ns 0.31 ns 0.31 ns 1.00

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 3388.25 ns 192.24 ns 180.23 ns 1.07
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3705.16 ns 163.37 ns 178.75 ns 0.91
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 136.83 ns 163.58 ns 0.84
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3547.10 ns 1297.10 ns 1235.97 ns 1.05

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 34.55 ns 11.72 ns 12.02 ns 0.98

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1396.00 ns 14.19 ns 14.20 ns 1.00
basic sample with immediate scheduler 1366.69 ns 5.55 ns 5.55 ns 1.00

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 898.68 ns 0.31 ns 0.31 ns 1.00

ci-macos

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 1117.14 ns 5.44 ns 4.33 ns 1.26
Subscribe empty callbacks to empty observable via pipe operator 1059.43 ns 5.40 ns 4.24 ns 1.27

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 2202.13 ns 0.44 ns 0.26 ns 1.69
from array of 1 - create + subscribe + current_thread 2773.21 ns 8.89 ns 28.33 ns 0.31
concat_as_source of just(1 immediate) create + subscribe 6578.08 ns 394.73 ns 364.19 ns 1.08
defer from array of 1 - defer + create + subscribe + immediate 2303.63 ns 0.28 ns 0.26 ns 1.07
interval - interval + take(3) + subscribe + immediate 6190.24 ns 91.44 ns 125.01 ns 0.73
interval - interval + take(3) + subscribe + current_thread 7473.69 ns 60.87 ns 118.18 ns 0.52

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 3338.82 ns 0.28 ns 0.60 ns 0.46
immediate_just+filter(true)+subscribe 2481.72 ns 0.28 ns 0.34 ns 0.82
immediate_just(1,2)+skip(1)+subscribe 3410.19 ns 0.28 ns 0.26 ns 1.07
immediate_just(1,1,2)+distinct_until_changed()+subscribe 2478.54 ns 0.56 ns 0.73 ns 0.76
immediate_just(1,2)+first()+subscribe 3839.63 ns 0.28 ns 0.47 ns 0.59
immediate_just(1,2)+last()+subscribe 2962.11 ns 0.28 ns 0.57 ns 0.49
immediate_just+take_last(1)+subscribe 3514.98 ns 70.57 ns 155.29 ns 0.45

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 990.37 ns 5.75 ns 4.48 ns 1.28
current_thread scheduler create worker + schedule 1293.44 ns 15.07 ns 42.47 ns 0.35
current_thread scheduler create worker + schedule + recursive schedule 2269.51 ns 156.89 ns 262.09 ns 0.60

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 2460.83 ns 0.28 ns 0.29 ns 0.97
immediate_just+scan(10, std::plus)+subscribe 2777.03 ns 0.56 ns 0.66 ns 0.85
immediate_just+flat_map(immediate_just(v*2))+subscribe 6407.68 ns 462.56 ns 467.72 ns 0.99
immediate_just+buffer(2)+subscribe 2930.45 ns 69.51 ns 131.00 ns 0.53
immediate_just+window(2)+subscribe + subscsribe inner 6539.89 ns 2597.91 ns 3052.35 ns 0.85

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 2459.84 ns - - 0.00
immediate_just+take_while(true)+subscribe 2477.00 ns 0.28 ns 0.50 ns 0.55

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 5989.58 ns 0.28 ns 0.54 ns 0.52

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 9012.33 ns 514.65 ns 810.28 ns 0.64
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 10173.15 ns 524.89 ns 798.07 ns 0.66
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 517.67 ns 551.18 ns 0.94
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 9852.62 ns 2354.47 ns 2246.14 ns 1.05

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 100.32 ns 62.05 ns 57.00 ns 1.09

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 3371.66 ns 45.01 ns 161.92 ns 0.28
basic sample with immediate scheduler 3352.96 ns 5.84 ns 16.80 ns 0.35

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 2820.81 ns 0.28 ns 0.28 ns 0.98

ci-ubuntu-clang

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 267.76 ns 0.88 ns 1.54 ns 0.57
Subscribe empty callbacks to empty observable via pipe operator 265.87 ns 0.88 ns 1.54 ns 0.57

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 565.81 ns 0.31 ns 0.31 ns 1.00
from array of 1 - create + subscribe + current_thread 792.51 ns 5.55 ns 5.56 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 1920.94 ns 112.48 ns 112.23 ns 1.00
defer from array of 1 - defer + create + subscribe + immediate 589.60 ns 0.31 ns 0.31 ns 1.00
interval - interval + take(3) + subscribe + immediate 1545.44 ns 57.11 ns 57.09 ns 1.00
interval - interval + take(3) + subscribe + current_thread 2113.50 ns 30.86 ns 30.88 ns 1.00

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 932.08 ns 0.31 ns 0.31 ns 1.00
immediate_just+filter(true)+subscribe 678.77 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 849.90 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 698.29 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+first()+subscribe 1111.80 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+last()+subscribe 751.55 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 964.25 ns 0.31 ns 0.31 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 197.78 ns 0.88 ns 1.54 ns 0.57
current_thread scheduler create worker + schedule 312.62 ns 5.58 ns 5.58 ns 1.00
current_thread scheduler create worker + schedule + recursive schedule 632.32 ns 60.40 ns 58.47 ns 1.03

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 687.75 ns 0.31 ns 0.31 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 716.83 ns 0.31 ns 0.31 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 1821.78 ns 119.03 ns 119.07 ns 1.00
immediate_just+buffer(2)+subscribe 1395.10 ns 14.19 ns 15.12 ns 0.94
immediate_just+window(2)+subscribe + subscsribe inner 2157.25 ns 755.64 ns 753.66 ns 1.00

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 649.58 ns - - 0.00
immediate_just+take_while(true)+subscribe 677.30 ns 0.31 ns 0.31 ns 1.00

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 1649.22 ns 0.31 ns 0.31 ns 1.00

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 2566.63 ns 126.05 ns 124.50 ns 1.01
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3126.73 ns 121.51 ns 121.07 ns 1.00
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 112.99 ns 112.26 ns 1.01
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 2784.38 ns 724.99 ns 741.59 ns 0.98

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 26.16 ns 12.96 ns 13.59 ns 0.95

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1057.64 ns 14.20 ns 14.19 ns 1.00
basic sample with immediate scheduler 1035.88 ns 6.17 ns 6.17 ns 1.00

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 750.84 ns 0.31 ns 0.31 ns 1.00

ci-windows

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 580.46 ns 4.94 ns 4.95 ns 1.00
Subscribe empty callbacks to empty observable via pipe operator 589.57 ns 4.94 ns 4.13 ns 1.20

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 1181.11 ns 4.93 ns 4.93 ns 1.00
from array of 1 - create + subscribe + current_thread 1441.94 ns 20.40 ns 20.39 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 4677.65 ns 173.06 ns 172.32 ns 1.00
defer from array of 1 - defer + create + subscribe + immediate 1218.88 ns 4.93 ns 4.93 ns 1.00
interval - interval + take(3) + subscribe + immediate 3156.48 ns 131.82 ns 129.68 ns 1.02
interval - interval + take(3) + subscribe + current_thread 3483.93 ns 59.52 ns 60.75 ns 0.98

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1887.31 ns 12.87 ns 12.88 ns 1.00
immediate_just+filter(true)+subscribe 1333.96 ns 12.39 ns 12.40 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1784.32 ns 13.06 ns 13.06 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 1371.94 ns 15.80 ns 15.94 ns 0.99
immediate_just(1,2)+first()+subscribe 2110.29 ns 12.64 ns 12.96 ns 0.97
immediate_just(1,2)+last()+subscribe 1488.95 ns 14.09 ns 14.14 ns 1.00
immediate_just+take_last(1)+subscribe 2063.65 ns 59.86 ns 59.14 ns 1.01

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 486.87 ns 7.07 ns 7.29 ns 0.97
current_thread scheduler create worker + schedule 667.20 ns 17.59 ns 17.83 ns 0.99
current_thread scheduler create worker + schedule + recursive schedule 1099.91 ns 109.74 ns 110.15 ns 1.00

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 1338.80 ns 12.31 ns 12.32 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 1447.72 ns 21.58 ns 21.27 ns 1.01
immediate_just+flat_map(immediate_just(v*2))+subscribe 3921.28 ns 233.16 ns 226.16 ns 1.03
immediate_just+buffer(2)+subscribe 2337.00 ns 61.19 ns 60.87 ns 1.01
immediate_just+window(2)+subscribe + subscsribe inner 4105.00 ns 1138.39 ns 1141.39 ns 1.00

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 1350.28 ns 11.49 ns 11.47 ns 1.00
immediate_just+take_while(true)+subscribe 1341.58 ns 12.37 ns 12.37 ns 1.00

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 3196.59 ns 7.40 ns 7.40 ns 1.00

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 5217.35 ns 243.59 ns 243.44 ns 1.00
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 6595.68 ns 239.23 ns 239.94 ns 1.00
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 226.87 ns 221.33 ns 1.03
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 5894.21 ns 948.62 ns 957.06 ns 0.99

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 36.25 ns 25.28 ns 25.28 ns 1.00

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1902.18 ns 59.61 ns 59.05 ns 1.01
basic sample with immediate scheduler 1901.12 ns 37.03 ns 37.03 ns 1.00

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 1455.48 ns 19.97 ns 19.97 ns 1.00

Copy link

codecov bot commented Feb 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (721b469) 95.53% compared to head (5b39ceb) 94.61%.
Report is 3 commits behind head on v2.

Additional details and impacted files
@@            Coverage Diff             @@
##               v2     #521      +/-   ##
==========================================
- Coverage   95.53%   94.61%   -0.92%     
==========================================
  Files          80       82       +2     
  Lines        2105     1524     -581     
==========================================
- Hits         2011     1442     -569     
+ Misses         94       82      -12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@victimsnino victimsnino merged commit 86d6fd8 into victimsnino:v2 Feb 10, 2024
27 of 28 checks passed
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