Skip to content

Disambiguate tap operator#625

Merged
AlexInLog merged 3 commits into
AlexInLog:v2from
CorentinBT:disanbiguate_tap
Aug 30, 2024
Merged

Disambiguate tap operator#625
AlexInLog merged 3 commits into
AlexInLog:v2from
CorentinBT:disanbiguate_tap

Conversation

@CorentinBT

@CorentinBT CorentinBT commented Aug 28, 2024

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Enhanced type safety for the tap function by ensuring the OnError parameter cannot be a template callable.
  • Bug Fixes

    • Improved robustness of the tap operator, preventing misuse with inappropriate callable types.
  • Tests

    • Added new test cases for the tap operator to verify its behavior with on_next callbacks, ensuring correct invocation and completion handling.

@coderabbitai

coderabbitai Bot commented Aug 28, 2024

Copy link
Copy Markdown
Contributor
Walkthrough

Walkthrough

The changes introduce a constraint on the OnError template parameter for the tap function in the rpp::operators namespace, ensuring that OnError is not a template callable. This is applied to two overloads of the tap function in the fwd.hpp and tap.hpp files. Additionally, a new test section is added to validate the behavior of the tap operator with an on_next callback in the test suite.

Changes

Files Change Summary
src/rpp/rpp/operators/fwd.hpp Updated tap function signatures to include a requires clause that enforces OnError is not a template callable for two overloads.
src/rpp/rpp/operators/tap.hpp Similar updates to tap function signatures as in fwd.hpp, adding a constraint on OnError to ensure it is not a template callable for both overloads.
src/tests/rpp/test_tap.cpp Added a new test section to verify the behavior of the tap operator with an on_next callback, including assertions for expected values, error handling, and completion events.

Sequence Diagram(s)

sequenceDiagram
    participant Observable
    participant TapOperator
    participant Callback

    Observable->>TapOperator: Emit value (1)
    TapOperator->>Callback: Invoke on_next(1)
    Callback-->>TapOperator: Acknowledge
    Observable->>TapOperator: Emit value (2)
    TapOperator->>Callback: Invoke on_next(2)
    Callback-->>TapOperator: Acknowledge
    Observable->>TapOperator: Emit value (3)
    TapOperator->>Callback: Invoke on_next(3)
    Callback-->>TapOperator: Acknowledge
    Observable->>TapOperator: Complete
    TapOperator->>Callback: Invoke on_completed()
Loading

Poem

🐰 In the meadow where code does play,
A tap operator brightens the day.
With constraints so tight,
Errors take flight,
Ensuring our logic won't sway!
Let's hop with delight,
For changes are right! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0e02593 and 307ea99.

Files selected for processing (3)
  • src/rpp/rpp/operators/fwd.hpp (2 hunks)
  • src/rpp/rpp/operators/tap.hpp (2 hunks)
  • src/tests/rpp/test_tap.cpp (1 hunks)
Additional comments not posted (5)
src/tests/rpp/test_tap.cpp (1)

78-90: LGTM!

The new test section is well-structured and covers the necessary assertions to validate the behavior of the tap operator with an on_next callback using an auto argument.

The code changes are approved.

src/rpp/rpp/operators/tap.hpp (2)

93-93: LGTM!

The addition of the requires clause enhances type safety by ensuring that only appropriate callable types can be used as the OnError handler.

The code changes are approved.


160-160: LGTM!

The addition of the requires clause enhances type safety by ensuring that only appropriate callable types can be used as the OnError handler.

The code changes are approved.

src/rpp/rpp/operators/fwd.hpp (2)

159-159: LGTM!

The addition of the requires clause enhances type safety by ensuring that only appropriate callable types can be used as the OnError handler.

The code changes are approved.


173-173: LGTM!

The addition of the requires clause enhances type safety by ensuring that only appropriate callable types can be used as the OnError handler.

The code changes are approved.

@github-actions

Copy link
Copy Markdown
Contributor

BENCHMARK RESULTS (AUTOGENERATED)

ci-ubuntu-gcc

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 302.11 ns 2.16 ns 2.17 ns 1.00
Subscribe empty callbacks to empty observable via pipe operator 300.87 ns 2.16 ns 2.16 ns 1.00

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 691.19 ns 0.31 ns 0.31 ns 1.00
from array of 1 - create + subscribe + current_thread 1055.99 ns 3.42 ns 3.42 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 2197.28 ns 100.95 ns 123.04 ns 0.82
defer from array of 1 - defer + create + subscribe + immediate 715.54 ns 0.31 ns 0.31 ns 1.00
interval - interval + take(3) + subscribe + immediate 2131.29 ns 59.23 ns 59.58 ns 0.99
interval - interval + take(3) + subscribe + current_thread 3079.04 ns 32.39 ns 32.47 ns 1.00
from array of 1 - create + as_blocking + subscribe + new_thread 29940.80 ns 28199.69 ns 28296.27 ns 1.00
from array of 1000 - create + as_blocking + subscribe + new_thread 40785.96 ns 51439.91 ns 52613.65 ns 0.98
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 3538.14 ns 135.15 ns 134.40 ns 1.01

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1058.79 ns 0.31 ns 0.31 ns 1.00
immediate_just+filter(true)+subscribe 879.66 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1015.72 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 874.08 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+first()+subscribe 1229.25 ns 0.62 ns 0.62 ns 1.00
immediate_just(1,2)+last()+subscribe 908.90 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 1118.97 ns 17.26 ns 17.28 ns 1.00
immediate_just(1,2,3)+element_at(1)+subscribe 829.31 ns 0.31 ns 0.31 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 267.47 ns 2.16 ns 2.16 ns 1.00
current_thread scheduler create worker + schedule 367.72 ns 5.55 ns 5.56 ns 1.00
current_thread scheduler create worker + schedule + recursive schedule 834.52 ns 56.70 ns 56.63 ns 1.00

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 838.61 ns 0.31 ns 0.31 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 887.47 ns 0.31 ns 0.31 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 2298.37 ns 164.70 ns 165.56 ns 0.99
immediate_just+buffer(2)+subscribe 1533.94 ns 13.56 ns 13.58 ns 1.00
immediate_just+window(2)+subscribe + subscsribe inner 2414.02 ns 1068.66 ns 1114.31 ns 0.96

Conditional Operators

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

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 1963.24 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 3418.14 ns 176.29 ns 186.21 ns 0.95
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3660.12 ns 179.72 ns 193.18 ns 0.93
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 131.74 ns 149.73 ns 0.88
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3573.28 ns 936.38 ns 994.22 ns 0.94
immediate_just(1) + zip(immediate_just(2)) + subscribe 2161.49 ns 205.01 ns 204.08 ns 1.00

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 34.55 ns 14.69 ns 29.93 ns 0.49
subscribe 100 observers to publish_subject 199625.33 ns 15295.76 ns 15902.61 ns 0.96
100 on_next to 100 observers to publish_subject 26556.64 ns 20074.25 ns 19028.90 ns 1.05

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1381.89 ns 12.95 ns 12.97 ns 1.00
basic sample with immediate scheduler 1424.10 ns 5.55 ns 5.55 ns 1.00

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 924.26 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 2145.59 ns 1010.33 ns 999.52 ns 1.01
create(on_error())+retry(1)+subscribe 590.06 ns 126.00 ns 137.21 ns 0.92

ci-macos

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 995.21 ns 3.98 ns 3.96 ns 1.01
Subscribe empty callbacks to empty observable via pipe operator 997.27 ns 4.01 ns 3.95 ns 1.02

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 2015.46 ns 0.24 ns 0.23 ns 1.02
from array of 1 - create + subscribe + current_thread 2493.63 ns 35.14 ns 35.24 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 5364.08 ns 333.52 ns 332.10 ns 1.00
defer from array of 1 - defer + create + subscribe + immediate 1957.50 ns 0.23 ns 0.24 ns 0.99
interval - interval + take(3) + subscribe + immediate 4893.85 ns 115.00 ns 118.20 ns 0.97
interval - interval + take(3) + subscribe + current_thread 6020.26 ns 98.29 ns 126.37 ns 0.78
from array of 1 - create + as_blocking + subscribe + new_thread 469550.00 ns 497941.00 ns 79168.14 ns 6.29
from array of 1000 - create + as_blocking + subscribe + new_thread 96792.50 ns 122697.25 ns 93282.08 ns 1.32
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 8119.01 ns 379.37 ns 380.90 ns 1.00

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 2829.63 ns 0.23 ns 0.25 ns 0.93
immediate_just+filter(true)+subscribe 2111.69 ns 0.23 ns 0.23 ns 0.99
immediate_just(1,2)+skip(1)+subscribe 2737.05 ns 0.23 ns 0.23 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 2055.52 ns 0.47 ns 0.50 ns 0.93
immediate_just(1,2)+first()+subscribe 3163.25 ns 0.23 ns 0.23 ns 1.00
immediate_just(1,2)+last()+subscribe 2363.69 ns 0.23 ns 0.23 ns 1.00
immediate_just+take_last(1)+subscribe 3013.33 ns 0.23 ns 0.24 ns 0.97
immediate_just(1,2,3)+element_at(1)+subscribe 2118.39 ns 0.23 ns 0.26 ns 0.91

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 844.57 ns 4.14 ns 4.98 ns 0.83
current_thread scheduler create worker + schedule 1181.56 ns 39.46 ns 45.78 ns 0.86
current_thread scheduler create worker + schedule + recursive schedule 1973.60 ns 207.88 ns 237.06 ns 0.88

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 2112.39 ns 4.21 ns 4.43 ns 0.95
immediate_just+scan(10, std::plus)+subscribe 2338.12 ns 0.47 ns 0.52 ns 0.91
immediate_just+flat_map(immediate_just(v*2))+subscribe 5292.72 ns 403.45 ns 405.26 ns 1.00
immediate_just+buffer(2)+subscribe 2489.49 ns 74.91 ns 71.65 ns 1.05
immediate_just+window(2)+subscribe + subscsribe inner 5308.87 ns 2385.35 ns 2569.94 ns 0.93

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 2155.47 ns - - 0.00
immediate_just+take_while(true)+subscribe 2712.87 ns 0.25 ns 0.25 ns 0.99

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 4882.50 ns 4.90 ns 4.91 ns 1.00

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 8209.56 ns 456.99 ns 536.66 ns 0.85
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 9486.89 ns 490.29 ns 489.83 ns 1.00
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 516.09 ns 458.60 ns 1.13
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 8138.11 ns 1973.97 ns 1901.38 ns 1.04
immediate_just(1) + zip(immediate_just(2)) + subscribe 5223.83 ns 863.64 ns 839.82 ns 1.03

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 76.90 ns 49.11 ns 49.06 ns 1.00
subscribe 100 observers to publish_subject 354458.67 ns 40749.18 ns 56341.04 ns 0.72
100 on_next to 100 observers to publish_subject 51259.95 ns 18655.29 ns 19749.84 ns 0.94

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 2760.72 ns 74.32 ns 77.59 ns 0.96
basic sample with immediate scheduler 2776.49 ns 18.95 ns 20.96 ns 0.90

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 2360.54 ns 0.23 ns 0.25 ns 0.92

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 6563.20 ns 4200.61 ns 4978.77 ns 0.84
create(on_error())+retry(1)+subscribe 1792.88 ns 297.03 ns 333.22 ns 0.89

ci-ubuntu-clang

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 267.41 ns 1.56 ns 1.56 ns 1.00
Subscribe empty callbacks to empty observable via pipe operator 281.99 ns 1.56 ns 1.56 ns 0.99

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 565.60 ns 0.31 ns 0.31 ns 1.00
from array of 1 - create + subscribe + current_thread 797.39 ns 4.01 ns 4.01 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 2334.78 ns 134.38 ns 135.35 ns 0.99
defer from array of 1 - defer + create + subscribe + immediate 776.06 ns 0.31 ns 0.31 ns 1.00
interval - interval + take(3) + subscribe + immediate 2228.09 ns 58.41 ns 58.31 ns 1.00
interval - interval + take(3) + subscribe + current_thread 3120.76 ns 30.88 ns 30.88 ns 1.00
from array of 1 - create + as_blocking + subscribe + new_thread 30564.15 ns 28182.02 ns 28152.84 ns 1.00
from array of 1000 - create + as_blocking + subscribe + new_thread 37134.67 ns 33801.79 ns 34094.66 ns 0.99
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 3682.91 ns 156.91 ns 157.93 ns 0.99

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1156.44 ns 0.31 ns 0.31 ns 1.00
immediate_just+filter(true)+subscribe 843.35 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1081.94 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 870.29 ns 0.62 ns 0.63 ns 0.98
immediate_just(1,2)+first()+subscribe 1365.83 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+last()+subscribe 1013.82 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 1190.87 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2,3)+element_at(1)+subscribe 867.88 ns 0.31 ns 0.31 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 279.70 ns 1.55 ns 1.57 ns 0.99
current_thread scheduler create worker + schedule 391.79 ns 4.01 ns 4.02 ns 1.00
current_thread scheduler create worker + schedule + recursive schedule 843.45 ns 60.94 ns 58.82 ns 1.04

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 853.46 ns 0.31 ns 0.31 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 963.35 ns 0.31 ns 0.31 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 2238.33 ns 137.95 ns 138.85 ns 0.99
immediate_just+buffer(2)+subscribe 1491.51 ns 13.88 ns 13.90 ns 1.00
immediate_just+window(2)+subscribe + subscsribe inner 2431.50 ns 929.88 ns 938.19 ns 0.99

Conditional Operators

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

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 2021.43 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 3276.49 ns 159.77 ns 157.65 ns 1.01
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3744.35 ns 147.00 ns 145.86 ns 1.01
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 143.07 ns 142.86 ns 1.00
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3360.18 ns 850.19 ns 841.91 ns 1.01
immediate_just(1) + zip(immediate_just(2)) + subscribe 2204.25 ns 203.27 ns 200.98 ns 1.01

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 54.01 ns 17.46 ns 17.78 ns 0.98
subscribe 100 observers to publish_subject 207598.80 ns 16200.17 ns 16269.43 ns 1.00
100 on_next to 100 observers to publish_subject 37347.33 ns 17670.02 ns 17902.22 ns 0.99

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1297.26 ns 11.42 ns 11.42 ns 1.00
basic sample with immediate scheduler 1292.71 ns 5.86 ns 5.86 ns 1.00

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 1042.42 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 2155.21 ns 1253.85 ns 1252.53 ns 1.00
create(on_error())+retry(1)+subscribe 664.23 ns 145.83 ns 145.90 ns 1.00

ci-windows

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 561.95 ns 4.02 ns 4.01 ns 1.00
Subscribe empty callbacks to empty observable via pipe operator 577.98 ns 4.02 ns 4.01 ns 1.00

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 1152.65 ns 9.71 ns 9.65 ns 1.01
from array of 1 - create + subscribe + current_thread 1432.80 ns 17.90 ns 17.90 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 3698.92 ns 176.01 ns 185.15 ns 0.95
defer from array of 1 - defer + create + subscribe + immediate 1189.57 ns 9.41 ns 9.42 ns 1.00
interval - interval + take(3) + subscribe + immediate 3719.50 ns 145.55 ns 145.93 ns 1.00
interval - interval + take(3) + subscribe + current_thread 3493.88 ns 64.75 ns 65.39 ns 0.99
from array of 1 - create + as_blocking + subscribe + new_thread 118580.00 ns 114280.00 ns 110766.67 ns 1.03
from array of 1000 - create + as_blocking + subscribe + new_thread 127911.11 ns 132355.56 ns 127912.50 ns 1.03
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 5507.81 ns 210.18 ns 213.06 ns 0.99

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1817.62 ns 25.28 ns 25.28 ns 1.00
immediate_just+filter(true)+subscribe 1314.94 ns 24.35 ns 24.36 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1701.46 ns 24.06 ns 24.06 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 1629.21 ns 29.01 ns 29.07 ns 1.00
immediate_just(1,2)+first()+subscribe 2065.66 ns 22.82 ns 22.82 ns 1.00
immediate_just(1,2)+last()+subscribe 1772.14 ns 24.07 ns 24.06 ns 1.00
immediate_just+take_last(1)+subscribe 2018.18 ns 69.94 ns 70.17 ns 1.00
immediate_just(1,2,3)+element_at(1)+subscribe 1342.97 ns 27.45 ns 27.49 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 477.26 ns 6.48 ns 6.17 ns 1.05
current_thread scheduler create worker + schedule 649.63 ns 14.06 ns 13.90 ns 1.01
current_thread scheduler create worker + schedule + recursive schedule 1096.57 ns 103.61 ns 105.78 ns 0.98

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 1310.39 ns 24.37 ns 24.36 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 1407.95 ns 26.82 ns 26.83 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 3457.74 ns 201.54 ns 203.55 ns 0.99
immediate_just+buffer(2)+subscribe 2622.33 ns 69.35 ns 68.73 ns 1.01
immediate_just+window(2)+subscribe + subscsribe inner 3989.73 ns 1311.60 ns 1301.11 ns 1.01

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 1615.51 ns 23.12 ns 23.12 ns 1.00
immediate_just+take_while(true)+subscribe 1315.18 ns 24.37 ns 24.35 ns 1.00

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 3120.87 ns 11.10 ns 11.10 ns 1.00

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 5256.94 ns 219.46 ns 224.57 ns 0.98
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 5421.69 ns 211.33 ns 227.40 ns 0.93
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 194.49 ns 203.08 ns 0.96
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 5382.16 ns 936.80 ns 924.70 ns 1.01
immediate_just(1) + zip(immediate_just(2)) + subscribe 3545.37 ns 517.00 ns 513.02 ns 1.01

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 36.57 ns 19.79 ns 20.38 ns 0.97
subscribe 100 observers to publish_subject 264275.00 ns 28856.10 ns 28613.89 ns 1.01
100 on_next to 100 observers to publish_subject 55061.90 ns 32650.00 ns 32670.97 ns 1.00

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1848.36 ns 100.98 ns 100.79 ns 1.00
basic sample with immediate scheduler 2203.13 ns 74.56 ns 73.99 ns 1.01

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 1448.55 ns 24.99 ns 24.97 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 2159.55 ns 350.60 ns 360.12 ns 0.97
create(on_error())+retry(1)+subscribe 1711.66 ns 143.61 ns 152.24 ns 0.94

@codecov

codecov Bot commented Aug 30, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.62%. Comparing base (c24e32c) to head (902c1da).
Report is 1 commits behind head on v2.

Additional details and impacted files
@@           Coverage Diff           @@
##               v2     #625   +/-   ##
=======================================
  Coverage   95.62%   95.62%           
=======================================
  Files          98       98           
  Lines        1897     1897           
=======================================
  Hits         1814     1814           
  Misses         83       83           

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

@sonarqubecloud

Copy link
Copy Markdown

@AlexInLog AlexInLog merged commit 6a4859f into AlexInLog:v2 Aug 30, 2024
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