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

Update subjects #526

Merged
merged 10 commits into from
Feb 17, 2024
Merged

Update subjects #526

merged 10 commits into from
Feb 17, 2024

Conversation

victimsnino
Copy link
Owner

@victimsnino victimsnino commented Feb 17, 2024

  1. make serialized subject easier to implement
  2. fix replay subject issues related to race-condition + mutex keeping

Copy link
Contributor

BENCHMARK RESULTS (AUTOGENERATED)

ci-ubuntu-gcc

General

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

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 710.79 ns 0.62 ns 0.31 ns 2.00
from array of 1 - create + subscribe + current_thread 1030.45 ns 5.25 ns 4.63 ns 1.13
concat_as_source of just(1 immediate) create + subscribe 2281.97 ns 133.88 ns 117.70 ns 1.14
defer from array of 1 - defer + create + subscribe + immediate 755.05 ns 0.31 ns 0.31 ns 1.00
interval - interval + take(3) + subscribe + immediate 2184.64 ns 58.01 ns 58.00 ns 1.00
interval - interval + take(3) + subscribe + current_thread 3015.38 ns 32.10 ns 32.14 ns 1.00

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1093.56 ns 0.31 ns 0.31 ns 1.00
immediate_just+filter(true)+subscribe 857.53 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1002.69 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 869.94 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+first()+subscribe 1232.71 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+last()+subscribe 926.96 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 1138.85 ns 19.14 ns 19.14 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 281.61 ns 2.16 ns 2.16 ns 1.00
current_thread scheduler create worker + schedule 386.90 ns 7.41 ns 6.49 ns 1.14
current_thread scheduler create worker + schedule + recursive schedule 837.99 ns 64.09 ns 65.31 ns 0.98

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 873.83 ns 0.31 ns 0.31 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 899.26 ns 0.31 ns 0.31 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 2363.34 ns 171.86 ns 161.80 ns 1.06
immediate_just+buffer(2)+subscribe 1564.98 ns 14.83 ns 14.82 ns 1.00
immediate_just+window(2)+subscribe + subscsribe inner 2411.44 ns 1075.69 ns 974.78 ns 1.10

Conditional Operators

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

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 1939.26 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 3505.18 ns 184.81 ns 170.92 ns 1.08
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3732.90 ns 169.11 ns 160.23 ns 1.06
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 147.84 ns 128.51 ns 1.15
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3694.99 ns 1016.51 ns 1020.09 ns 1.00
immediate_just(1) + zip(immediate_just(2)) + subscribe 2209.30 ns 216.28 ns 204.43 ns 1.06

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 34.56 ns 11.72 ns 12.03 ns 0.97

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1390.46 ns 16.37 ns 13.60 ns 1.20
basic sample with immediate scheduler 1407.53 ns 5.55 ns 5.55 ns 1.00

Aggregating Operators

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

ci-macos

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 1088.32 ns 5.39 ns 4.48 ns 1.20
Subscribe empty callbacks to empty observable via pipe operator 1090.76 ns 5.38 ns 4.78 ns 1.12

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 2493.69 ns 0.45 ns 0.27 ns 1.67
from array of 1 - create + subscribe + current_thread 2930.24 ns 8.65 ns 29.39 ns 0.29
concat_as_source of just(1 immediate) create + subscribe 6847.49 ns 403.28 ns 379.24 ns 1.06
defer from array of 1 - defer + create + subscribe + immediate 2376.81 ns 0.28 ns 0.28 ns 1.00
interval - interval + take(3) + subscribe + immediate 6165.78 ns 92.76 ns 140.17 ns 0.66
interval - interval + take(3) + subscribe + current_thread 7556.29 ns 61.48 ns 131.99 ns 0.47

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 3443.95 ns 0.28 ns 0.29 ns 0.94
immediate_just+filter(true)+subscribe 2621.52 ns 0.28 ns 0.26 ns 1.07
immediate_just(1,2)+skip(1)+subscribe 3409.44 ns 0.28 ns 0.27 ns 1.04
immediate_just(1,1,2)+distinct_until_changed()+subscribe 2505.97 ns 0.56 ns 0.55 ns 1.00
immediate_just(1,2)+first()+subscribe 4008.52 ns 0.28 ns 0.26 ns 1.07
immediate_just(1,2)+last()+subscribe 3066.21 ns 0.28 ns 0.26 ns 1.05
immediate_just+take_last(1)+subscribe 3987.76 ns 71.70 ns 82.36 ns 0.87

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 985.93 ns 5.73 ns 5.16 ns 1.11
current_thread scheduler create worker + schedule 1290.41 ns 14.92 ns 42.03 ns 0.36
current_thread scheduler create worker + schedule + recursive schedule 2268.85 ns 158.80 ns 249.34 ns 0.64

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 2524.96 ns 0.28 ns 0.25 ns 1.13
immediate_just+scan(10, std::plus)+subscribe 2850.74 ns 0.56 ns 0.52 ns 1.07
immediate_just+flat_map(immediate_just(v*2))+subscribe 6788.79 ns 472.70 ns 438.04 ns 1.08
immediate_just+buffer(2)+subscribe 3063.21 ns 69.67 ns 76.88 ns 0.91
immediate_just+window(2)+subscribe + subscsribe inner 6658.99 ns 2698.64 ns 2318.19 ns 1.16

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 2566.37 ns - - 0.00
immediate_just+take_while(true)+subscribe 2540.83 ns 0.28 ns 0.23 ns 1.19

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 6038.22 ns 0.28 ns 0.28 ns 0.99

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 9272.34 ns 530.67 ns 502.63 ns 1.06
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 10451.60 ns 522.62 ns 522.83 ns 1.00
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 522.21 ns 533.52 ns 0.98
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 10203.83 ns 2351.08 ns 2052.12 ns 1.15
immediate_just(1) + zip(immediate_just(2)) + subscribe 6487.95 ns 949.86 ns 888.41 ns 1.07

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 98.24 ns 62.25 ns 57.59 ns 1.08

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 3667.19 ns 46.79 ns 108.49 ns 0.43
basic sample with immediate scheduler 3579.81 ns 5.86 ns 16.64 ns 0.35

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 2905.40 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 276.62 ns 0.88 ns 1.58 ns 0.56
Subscribe empty callbacks to empty observable via pipe operator 273.97 ns 0.88 ns 1.56 ns 0.56

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 578.45 ns 0.31 ns 0.31 ns 1.00
from array of 1 - create + subscribe + current_thread 790.81 ns 5.55 ns 5.56 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 1893.88 ns 113.55 ns 112.55 ns 1.01
defer from array of 1 - defer + create + subscribe + immediate 595.90 ns 0.31 ns 0.31 ns 1.00
interval - interval + take(3) + subscribe + immediate 1519.69 ns 57.03 ns 57.03 ns 1.00
interval - interval + take(3) + subscribe + current_thread 2125.81 ns 30.86 ns 30.86 ns 1.00

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 969.90 ns 0.31 ns 0.31 ns 1.00
immediate_just+filter(true)+subscribe 658.76 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 855.25 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 697.27 ns 0.62 ns 0.31 ns 1.98
immediate_just(1,2)+first()+subscribe 1108.17 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+last()+subscribe 767.81 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 1020.17 ns 0.31 ns 0.31 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 203.18 ns 0.88 ns 1.56 ns 0.56
current_thread scheduler create worker + schedule 305.25 ns 5.58 ns 5.57 ns 1.00
current_thread scheduler create worker + schedule + recursive schedule 631.64 ns 58.30 ns 59.41 ns 0.98

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 700.08 ns 0.31 ns 0.31 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 711.47 ns 0.31 ns 0.31 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 1885.43 ns 121.58 ns 122.81 ns 0.99
immediate_just+buffer(2)+subscribe 1370.86 ns 14.81 ns 14.50 ns 1.02
immediate_just+window(2)+subscribe + subscsribe inner 2158.69 ns 833.26 ns 774.81 ns 1.08

Conditional Operators

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

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 1663.51 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 2579.73 ns 127.00 ns 128.80 ns 0.99
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3039.13 ns 123.80 ns 121.84 ns 1.02
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 112.40 ns 112.75 ns 1.00
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 2631.11 ns 745.66 ns 733.25 ns 1.02
immediate_just(1) + zip(immediate_just(2)) + subscribe 1871.59 ns 173.93 ns 169.14 ns 1.03

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 26.16 ns 15.42 ns 13.88 ns 1.11

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1022.38 ns 13.27 ns 13.57 ns 0.98
basic sample with immediate scheduler 1031.93 ns 5.86 ns 6.17 ns 0.95

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 753.34 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.77 ns 4.01 ns 4.80 ns 0.84
Subscribe empty callbacks to empty observable via pipe operator 587.28 ns 4.01 ns 4.74 ns 0.85

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 1169.75 ns 5.24 ns 5.24 ns 1.00
from array of 1 - create + subscribe + current_thread 1433.63 ns 19.79 ns 19.74 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 4725.21 ns 182.10 ns 175.44 ns 1.04
defer from array of 1 - defer + create + subscribe + immediate 1213.32 ns 5.24 ns 5.24 ns 1.00
interval - interval + take(3) + subscribe + immediate 3214.67 ns 130.59 ns 131.12 ns 1.00
interval - interval + take(3) + subscribe + current_thread 3482.88 ns 60.75 ns 59.52 ns 1.02

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1885.77 ns 12.87 ns 12.87 ns 1.00
immediate_just+filter(true)+subscribe 1710.87 ns 12.37 ns 12.37 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1781.91 ns 13.12 ns 13.05 ns 1.01
immediate_just(1,1,2)+distinct_until_changed()+subscribe 1411.25 ns 19.75 ns 17.94 ns 1.10
immediate_just(1,2)+first()+subscribe 2113.22 ns 12.95 ns 12.94 ns 1.00
immediate_just(1,2)+last()+subscribe 1789.56 ns 14.10 ns 14.08 ns 1.00
immediate_just+take_last(1)+subscribe 2068.41 ns 60.98 ns 59.01 ns 1.03

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 491.06 ns 7.31 ns 7.40 ns 0.99
current_thread scheduler create worker + schedule 667.88 ns 17.92 ns 17.60 ns 1.02
current_thread scheduler create worker + schedule + recursive schedule 1103.26 ns 111.42 ns 109.26 ns 1.02

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 1355.17 ns 12.29 ns 12.26 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 1461.45 ns 21.58 ns 21.29 ns 1.01
immediate_just+flat_map(immediate_just(v*2))+subscribe 3927.64 ns 228.67 ns 233.28 ns 0.98
immediate_just+buffer(2)+subscribe 2370.14 ns 58.29 ns 59.83 ns 0.97
immediate_just+window(2)+subscribe + subscsribe inner 4095.54 ns 1559.06 ns 1505.77 ns 1.04

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 1357.85 ns 11.45 ns 11.44 ns 1.00
immediate_just+take_while(true)+subscribe 1371.45 ns 12.37 ns 12.40 ns 1.00

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 3870.37 ns 7.71 ns 7.71 ns 1.00

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 5517.74 ns 235.77 ns 229.47 ns 1.03
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 6562.64 ns 258.09 ns 231.82 ns 1.11
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 226.17 ns 232.32 ns 0.97
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 6289.60 ns 1004.60 ns 976.34 ns 1.03
immediate_just(1) + zip(immediate_just(2)) + subscribe 3872.83 ns 549.73 ns 560.66 ns 0.98

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 36.64 ns 26.60 ns 27.13 ns 0.98

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1895.77 ns 59.45 ns 67.81 ns 0.88
basic sample with immediate scheduler 1891.78 ns 39.17 ns 39.17 ns 1.00

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 1483.69 ns 19.98 ns 17.83 ns 1.12

@victimsnino victimsnino marked this pull request as ready for review February 17, 2024 12:27
Copy link

@victimsnino victimsnino merged commit d90e39e into v2 Feb 17, 2024
27 checks passed
@victimsnino victimsnino deleted the update_subjects branch February 17, 2024 12:37
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