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 variant_observable to avoid dynamic coversions #588

Merged
merged 11 commits into from
May 28, 2024
Merged

Conversation

victimsnino
Copy link
Owner

No description provided.

Copy link
Contributor

github-actions bot commented May 27, 2024

BENCHMARK RESULTS (AUTOGENERATED)

ci-ubuntu-gcc

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 317.51 ns 2.16 ns 2.19 ns 0.99
Subscribe empty callbacks to empty observable via pipe operator 320.38 ns 2.16 ns 2.23 ns 0.97

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 706.70 ns 0.31 ns 0.54 ns 0.57
from array of 1 - create + subscribe + current_thread 1094.75 ns 3.70 ns 3.64 ns 1.02
concat_as_source of just(1 immediate) create + subscribe 2235.06 ns 141.50 ns 137.01 ns 1.03
defer from array of 1 - defer + create + subscribe + immediate 731.49 ns 0.31 ns 0.31 ns 1.00
interval - interval + take(3) + subscribe + immediate 2149.60 ns 59.23 ns 59.19 ns 1.00
interval - interval + take(3) + subscribe + current_thread 2981.61 ns 32.42 ns 33.64 ns 0.96
from array of 1 - create + as_blocking + subscribe + new_thread 30913.46 ns 28454.21 ns 28174.06 ns 1.01
from array of 1000 - create + as_blocking + subscribe + new_thread 39450.38 ns 49192.35 ns 52982.95 ns 0.93
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 3459.50 ns 137.63 ns - 0.00

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1099.93 ns 0.31 ns 0.31 ns 1.00
immediate_just+filter(true)+subscribe 838.19 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1018.23 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 852.13 ns 0.31 ns 0.31 ns 0.99
immediate_just(1,2)+first()+subscribe 1224.81 ns 0.62 ns 0.31 ns 2.00
immediate_just(1,2)+last()+subscribe 915.78 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 1096.71 ns 17.28 ns 17.90 ns 0.97

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 272.77 ns 2.16 ns 2.16 ns 1.00
current_thread scheduler create worker + schedule 369.11 ns 5.56 ns 5.62 ns 0.99
current_thread scheduler create worker + schedule + recursive schedule 841.22 ns 55.91 ns 56.33 ns 0.99

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 822.50 ns 0.31 ns 0.32 ns 0.97
immediate_just+scan(10, std::plus)+subscribe 921.11 ns 0.31 ns 0.31 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 2329.27 ns 168.20 ns 196.83 ns 0.85
immediate_just+buffer(2)+subscribe 1504.95 ns 13.58 ns 13.73 ns 0.99
immediate_just+window(2)+subscribe + subscsribe inner 2371.09 ns 986.89 ns 1068.95 ns 0.92

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 869.71 ns - - 0.00
immediate_just+take_while(true)+subscribe 849.39 ns 0.31 ns 0.39 ns 0.80

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 1975.83 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 3432.14 ns 180.01 ns 197.27 ns 0.91
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3735.95 ns 175.64 ns 179.95 ns 0.98
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 156.64 ns 164.42 ns 0.95
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3508.09 ns 947.48 ns 1037.88 ns 0.91
immediate_just(1) + zip(immediate_just(2)) + subscribe 2072.91 ns 204.82 ns 207.81 ns 0.99

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 34.49 ns 16.80 ns 16.87 ns 1.00

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1389.87 ns 12.96 ns 13.58 ns 0.95
basic sample with immediate scheduler 1386.35 ns 5.55 ns 5.55 ns 1.00

Aggregating Operators

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

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 1028.96 ns 118.03 ns 118.72 ns 0.99

ci-macos

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 1022.02 ns 3.93 ns 3.93 ns 1.00
Subscribe empty callbacks to empty observable via pipe operator 968.08 ns 3.93 ns 4.26 ns 0.92

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 1911.55 ns 0.23 ns 0.30 ns 0.77
from array of 1 - create + subscribe + current_thread 2408.46 ns 31.07 ns 42.77 ns 0.73
concat_as_source of just(1 immediate) create + subscribe 5474.99 ns 335.11 ns 454.22 ns 0.74
defer from array of 1 - defer + create + subscribe + immediate 1993.09 ns 0.23 ns 0.27 ns 0.86
interval - interval + take(3) + subscribe + immediate 4927.15 ns 114.99 ns 154.25 ns 0.75
interval - interval + take(3) + subscribe + current_thread 6052.25 ns 94.70 ns 132.23 ns 0.72
from array of 1 - create + as_blocking + subscribe + new_thread 82408.79 ns 80365.00 ns 98817.42 ns 0.81
from array of 1000 - create + as_blocking + subscribe + new_thread 88070.17 ns 86325.33 ns 124247.56 ns 0.69
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 8181.87 ns 377.24 ns - 0.00

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 2878.06 ns 0.23 ns 0.33 ns 0.70
immediate_just+filter(true)+subscribe 2134.49 ns 0.23 ns 0.33 ns 0.71
immediate_just(1,2)+skip(1)+subscribe 2638.76 ns 0.22 ns 0.30 ns 0.75
immediate_just(1,1,2)+distinct_until_changed()+subscribe 1991.62 ns 0.45 ns 0.63 ns 0.71
immediate_just(1,2)+first()+subscribe 3063.03 ns 0.22 ns 0.32 ns 0.70
immediate_just(1,2)+last()+subscribe 2284.57 ns 0.22 ns 0.32 ns 0.71
immediate_just+take_last(1)+subscribe 3065.42 ns 70.84 ns 103.66 ns 0.68

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 847.51 ns 4.17 ns 6.41 ns 0.65
current_thread scheduler create worker + schedule 1197.44 ns 35.91 ns 44.71 ns 0.80
current_thread scheduler create worker + schedule + recursive schedule 2002.47 ns 203.01 ns 224.72 ns 0.90

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 2029.01 ns 0.25 ns 0.32 ns 0.76
immediate_just+scan(10, std::plus)+subscribe 2255.32 ns 0.45 ns 0.63 ns 0.71
immediate_just+flat_map(immediate_just(v*2))+subscribe 5086.88 ns 382.10 ns 562.03 ns 0.68
immediate_just+buffer(2)+subscribe 2489.79 ns 67.24 ns 103.08 ns 0.65
immediate_just+window(2)+subscribe + subscsribe inner 5364.29 ns 2321.63 ns 3404.27 ns 0.68

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 2008.71 ns - - 0.00
immediate_just+take_while(true)+subscribe 2033.34 ns 0.22 ns 0.36 ns 0.62

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 4683.70 ns 0.22 ns 0.26 ns 0.86

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 7394.10 ns 440.76 ns 447.38 ns 0.99
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 8006.76 ns 439.61 ns 468.39 ns 0.94
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 439.83 ns 535.86 ns 0.82
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 7630.00 ns 1869.51 ns 1920.77 ns 0.97
immediate_just(1) + zip(immediate_just(2)) + subscribe 4932.15 ns 805.64 ns 866.81 ns 0.93

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 73.51 ns 48.24 ns 68.46 ns 0.70

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 2717.77 ns 67.13 ns 73.96 ns 0.91
basic sample with immediate scheduler 2704.65 ns 14.94 ns 15.42 ns 0.97

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 2278.93 ns 0.22 ns 0.32 ns 0.71

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 6246.17 ns 3840.46 ns 5019.48 ns 0.77

ci-ubuntu-clang

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 266.71 ns 1.56 ns 1.54 ns 1.01
Subscribe empty callbacks to empty observable via pipe operator 275.11 ns 1.56 ns 1.54 ns 1.01

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 568.12 ns 0.42 ns 0.31 ns 1.35
from array of 1 - create + subscribe + current_thread 796.88 ns 4.32 ns 4.01 ns 1.08
concat_as_source of just(1 immediate) create + subscribe 2410.87 ns 134.48 ns 134.71 ns 1.00
defer from array of 1 - defer + create + subscribe + immediate 807.96 ns 0.31 ns 0.31 ns 1.00
interval - interval + take(3) + subscribe + immediate 2262.28 ns 58.31 ns 58.26 ns 1.00
interval - interval + take(3) + subscribe + current_thread 3224.57 ns 30.88 ns 30.88 ns 1.00
from array of 1 - create + as_blocking + subscribe + new_thread 31115.12 ns 28681.81 ns 27600.56 ns 1.04
from array of 1000 - create + as_blocking + subscribe + new_thread 40414.89 ns 37235.24 ns 33733.69 ns 1.10
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 3752.30 ns 158.04 ns - 0.00

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1157.43 ns 0.31 ns 0.31 ns 1.00
immediate_just+filter(true)+subscribe 848.12 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1069.93 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 882.48 ns 0.62 ns 0.31 ns 2.00
immediate_just(1,2)+first()+subscribe 1365.48 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+last()+subscribe 1008.31 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 1192.88 ns 0.31 ns 0.31 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 315.51 ns 1.56 ns 1.54 ns 1.01
current_thread scheduler create worker + schedule 421.62 ns 4.63 ns 4.82 ns 0.96
current_thread scheduler create worker + schedule + recursive schedule 873.57 ns 57.40 ns 57.30 ns 1.00

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 856.83 ns 0.31 ns 0.31 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 958.10 ns 0.31 ns 0.62 ns 0.50
immediate_just+flat_map(immediate_just(v*2))+subscribe 2236.03 ns 140.25 ns 140.06 ns 1.00
immediate_just+buffer(2)+subscribe 1555.41 ns 13.89 ns 13.89 ns 1.00
immediate_just+window(2)+subscribe + subscsribe inner 2435.39 ns 907.27 ns 903.43 ns 1.00

Conditional Operators

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

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 2004.12 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 3310.99 ns 159.66 ns 159.24 ns 1.00
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3761.95 ns 147.30 ns 147.16 ns 1.00
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 144.15 ns 141.92 ns 1.02
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3458.40 ns 845.85 ns 849.75 ns 1.00
immediate_just(1) + zip(immediate_just(2)) + subscribe 2229.88 ns 202.47 ns 208.09 ns 0.97

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 54.14 ns 19.07 ns 18.61 ns 1.02

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1297.56 ns 12.35 ns 12.04 ns 1.03
basic sample with immediate scheduler 1283.68 ns 6.17 ns 5.86 ns 1.05

Aggregating Operators

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

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 1054.59 ns 136.59 ns 133.24 ns 1.03

ci-windows

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 598.70 ns 4.02 ns 4.68 ns 0.86
Subscribe empty callbacks to empty observable via pipe operator 608.30 ns 4.01 ns 4.72 ns 0.85

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 1220.27 ns 5.24 ns 4.93 ns 1.06
from array of 1 - create + subscribe + current_thread 1486.17 ns 15.44 ns 15.74 ns 0.98
concat_as_source of just(1 immediate) create + subscribe 3858.63 ns 186.86 ns 172.43 ns 1.08
defer from array of 1 - defer + create + subscribe + immediate 1253.06 ns 5.24 ns 4.93 ns 1.06
interval - interval + take(3) + subscribe + immediate 3834.71 ns 133.54 ns 134.03 ns 1.00
interval - interval + take(3) + subscribe + current_thread 3528.09 ns 53.63 ns 53.25 ns 1.01
from array of 1 - create + as_blocking + subscribe + new_thread 127844.44 ns 121433.33 ns 111500.00 ns 1.09
from array of 1000 - create + as_blocking + subscribe + new_thread 132328.57 ns 136462.50 ns 126100.00 ns 1.08
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 5719.23 ns 213.33 ns - 0.00

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1871.60 ns 12.87 ns 12.86 ns 1.00
immediate_just+filter(true)+subscribe 1364.83 ns 11.72 ns 12.37 ns 0.95
immediate_just(1,2)+skip(1)+subscribe 1761.97 ns 13.05 ns 13.02 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 1382.17 ns 15.82 ns 15.95 ns 0.99
immediate_just(1,2)+first()+subscribe 2100.39 ns 12.61 ns 12.94 ns 0.97
immediate_just(1,2)+last()+subscribe 1809.50 ns 14.09 ns 13.78 ns 1.02
immediate_just+take_last(1)+subscribe 2050.54 ns 57.73 ns 59.19 ns 0.98

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 510.04 ns 6.17 ns 6.48 ns 0.95
current_thread scheduler create worker + schedule 693.68 ns 13.66 ns 13.11 ns 1.04
current_thread scheduler create worker + schedule + recursive schedule 1162.03 ns 104.06 ns 103.28 ns 1.01

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 1358.03 ns 11.18 ns 12.25 ns 0.91
immediate_just+scan(10, std::plus)+subscribe 1470.00 ns 21.27 ns 21.58 ns 0.99
immediate_just+flat_map(immediate_just(v*2))+subscribe 3635.65 ns 220.76 ns 219.41 ns 1.01
immediate_just+buffer(2)+subscribe 2654.55 ns 57.21 ns 63.58 ns 0.90
immediate_just+window(2)+subscribe + subscsribe inner 4134.25 ns 1243.53 ns 1227.77 ns 1.01

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 1716.83 ns 11.41 ns 11.44 ns 1.00
immediate_just+take_while(true)+subscribe 1369.15 ns 11.71 ns 12.38 ns 0.95

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 3206.23 ns 7.71 ns 7.09 ns 1.09

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 5358.25 ns 241.93 ns 232.26 ns 1.04
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 5623.28 ns 241.92 ns 223.96 ns 1.08
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 238.55 ns 231.36 ns 1.03
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 5581.99 ns 988.65 ns 938.80 ns 1.05
immediate_just(1) + zip(immediate_just(2)) + subscribe 3693.80 ns 565.53 ns 550.67 ns 1.03

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 37.00 ns 26.53 ns 25.59 ns 1.04

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1943.62 ns 58.04 ns 58.33 ns 1.00
basic sample with immediate scheduler 2222.09 ns 37.95 ns 36.73 ns 1.03

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 1485.19 ns 19.98 ns 19.94 ns 1.00

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 1979.17 ns 353.51 ns 340.19 ns 1.04

@victimsnino victimsnino changed the title Remove unused thing Add variant_observable to avoid dynamic coversions May 27, 2024
@victimsnino victimsnino marked this pull request as ready for review May 28, 2024 19:40
Copy link

sonarcloud bot commented May 28, 2024

@victimsnino victimsnino merged commit 7b3c551 into v2 May 28, 2024
35 checks passed
@victimsnino victimsnino deleted the minor_fix branch May 28, 2024 19:46
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