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

improve static_asserts #643

Merged
merged 4 commits into from
Sep 20, 2024
Merged

improve static_asserts #643

merged 4 commits into from
Sep 20, 2024

Conversation

victimsnino
Copy link
Owner

@victimsnino victimsnino commented Sep 19, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced error handling for template functions, improving clarity in compilation messages.
    • Updated finally function to enforce nothrow invocable constraints, ensuring safer execution.
    • Modifications to group_by and map operators to enforce return type checks, enhancing type safety.
  • Bug Fixes

    • Removed flat_map function, streamlining functionality and improving API clarity.
  • Refactor

    • Improved constraints in various operators for better type safety and readability.

Copy link
Contributor

coderabbitai bot commented Sep 19, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

Walkthrough

The changes introduced in this pull request involve modifications to several files within the rpp library. Key updates include the introduction of stricter type constraints for template parameters, enhancements to error handling in observable instances, and the removal of the flat_map function. Additionally, static assertions have been refined to ensure that certain functions return non-void types. These adjustments aim to improve type safety and clarity in the codebase.

Changes

File Path Change Summary
src/rpp/rpp/observables/observable.hpp Added an if constexpr check for result_type in operator_traits to enhance error reporting and type safety.
src/rpp/rpp/operators/finally.hpp, src/rpp/rpp/operators/fwd.hpp Changed finally function template parameter from std::invocable<> to rpp::constraint::is_nothrow_invocable for improved reliability. Removed flat_map function entirely.
src/rpp/rpp/operators/group_by.hpp Updated static assertions to ensure KeySelector and ValueSelector return non-void types, enhancing type safety.
src/rpp/rpp/operators/map.hpp Modified static assertion to ensure that Fn must return a type other than void when invoked with T.
src/rpp/rpp/utils/constraints.hpp Refined static_pointer_convertible_to concept to explicitly require a pointer parameter, improving clarity and type safety.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant FinallyOperator
    participant NothrowFunction

    User->>FinallyOperator: Call finally(lastFn)
    FinallyOperator->>NothrowFunction: Check if lastFn is nothrow invocable
    NothrowFunction-->>FinallyOperator: Validates nothrow condition
    FinallyOperator-->>User: Executes lastFn safely
Loading

🐇 "In the code we hop and play,
With types so safe, come what may.
No more voids, just clear returns,
In every function, wisdom churns.
So let us code, with joy and cheer,
For every change, we hold so dear!" 🐇

Possibly related PRs

  • improve static_asserts #643: The changes in this PR involve an additional if constexpr check in the observable.hpp file, which directly relates to the modifications made in the main PR that also introduces a similar check for result_type within the same file.

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>, please review it.
    -- 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @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.

Copy link
Contributor

BENCHMARK RESULTS (AUTOGENERATED)

ci-ubuntu-gcc

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 302.47 ns 2.18 ns 2.19 ns 1.00
Subscribe empty callbacks to empty observable via pipe operator 309.62 ns 2.18 ns 2.16 ns 1.01

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 686.12 ns 0.31 ns 0.31 ns 1.01
from array of 1 - create + subscribe + current_thread 1051.78 ns 3.73 ns 3.70 ns 1.01
concat_as_source of just(1 immediate) create + subscribe 2229.18 ns 157.25 ns 120.59 ns 1.30
defer from array of 1 - defer + create + subscribe + immediate 775.61 ns 0.31 ns 0.31 ns 1.01
interval - interval + take(3) + subscribe + immediate 2148.15 ns 59.58 ns 59.19 ns 1.01
interval - interval + take(3) + subscribe + current_thread 3049.78 ns 32.62 ns 32.40 ns 1.01
from array of 1 - create + as_blocking + subscribe + new_thread 31978.65 ns 35685.16 ns 31627.25 ns 1.13
from array of 1000 - create + as_blocking + subscribe + new_thread 44025.04 ns 56973.55 ns 52459.94 ns 1.09
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 3518.68 ns 227.65 ns 135.40 ns 1.68

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1078.84 ns 0.31 ns 0.31 ns 1.01
immediate_just+filter(true)+subscribe 856.46 ns 0.31 ns 0.31 ns 1.01
immediate_just(1,2)+skip(1)+subscribe 979.51 ns 0.31 ns 0.31 ns 1.01
immediate_just(1,1,2)+distinct_until_changed()+subscribe 844.24 ns 0.31 ns 0.31 ns 1.01
immediate_just(1,2)+first()+subscribe 1219.65 ns 0.31 ns 0.31 ns 1.01
immediate_just(1,2)+last()+subscribe 923.27 ns 0.31 ns 0.31 ns 1.01
immediate_just+take_last(1)+subscribe 1117.61 ns 18.65 ns 17.90 ns 1.04
immediate_just(1,2,3)+element_at(1)+subscribe 824.43 ns 0.31 ns 0.31 ns 1.01

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 270.28 ns 2.18 ns 2.17 ns 1.01
current_thread scheduler create worker + schedule 371.38 ns 5.90 ns 5.86 ns 1.01
current_thread scheduler create worker + schedule + recursive schedule 856.90 ns 56.75 ns 56.58 ns 1.00

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 863.64 ns 0.31 ns 0.31 ns 1.01
immediate_just+scan(10, std::plus)+subscribe 885.72 ns 0.31 ns 0.31 ns 1.01
immediate_just+flat_map(immediate_just(v*2))+subscribe 2326.78 ns 210.97 ns 173.01 ns 1.22
immediate_just+buffer(2)+subscribe 1580.70 ns 14.29 ns 13.58 ns 1.05
immediate_just+window(2)+subscribe + subscsribe inner 2444.36 ns 1325.72 ns 1072.71 ns 1.24

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 828.53 ns - - 0.00
immediate_just+take_while(true)+subscribe 838.72 ns 0.31 ns 0.31 ns 1.01

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 1959.57 ns 0.31 ns 0.31 ns 1.01

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 3554.26 ns 255.89 ns 188.62 ns 1.36
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3637.13 ns 206.10 ns 183.53 ns 1.12
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 182.07 ns 140.16 ns 1.30
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3613.19 ns 1230.35 ns 1101.62 ns 1.12
immediate_just(1) + zip(immediate_just(2)) + subscribe 2112.97 ns 203.86 ns 223.15 ns 0.91

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 34.69 ns 14.82 ns 14.71 ns 1.01
subscribe 100 observers to publish_subject 199753.80 ns 17125.91 ns 15760.26 ns 1.09
100 on_next to 100 observers to publish_subject 32723.56 ns 17253.24 ns 17221.73 ns 1.00

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1433.08 ns 12.74 ns 12.96 ns 0.98
basic sample with immediate scheduler 1337.05 ns 5.59 ns 5.56 ns 1.01

Aggregating Operators

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

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 2043.51 ns 903.16 ns 988.30 ns 0.91
create(on_error())+retry(1)+subscribe 591.98 ns 122.30 ns 98.40 ns 1.24

ci-macos

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 1084.25 ns 4.36 ns 3.88 ns 1.12
Subscribe empty callbacks to empty observable via pipe operator 1083.54 ns 4.34 ns 3.87 ns 1.12

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 2152.47 ns 0.26 ns 0.24 ns 1.10
from array of 1 - create + subscribe + current_thread 2751.22 ns 37.57 ns 33.94 ns 1.11
concat_as_source of just(1 immediate) create + subscribe 6752.12 ns 501.15 ns 370.61 ns 1.35
defer from array of 1 - defer + create + subscribe + immediate 3194.91 ns 0.56 ns 0.23 ns 2.38
interval - interval + take(3) + subscribe + immediate 6316.35 ns 127.73 ns 114.57 ns 1.11
interval - interval + take(3) + subscribe + current_thread 9108.50 ns 107.71 ns 96.48 ns 1.12
from array of 1 - create + as_blocking + subscribe + new_thread 115237.90 ns 118463.33 ns 96759.08 ns 1.22
from array of 1000 - create + as_blocking + subscribe + new_thread 111678.88 ns 121974.56 ns 108004.75 ns 1.13
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 12854.88 ns 760.61 ns 377.16 ns 2.02

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 4372.26 ns 0.36 ns 0.28 ns 1.27
immediate_just+filter(true)+subscribe 3407.93 ns 0.29 ns 0.23 ns 1.22
immediate_just(1,2)+skip(1)+subscribe 3883.82 ns 0.35 ns 0.26 ns 1.35
immediate_just(1,1,2)+distinct_until_changed()+subscribe 2436.51 ns 0.68 ns 0.47 ns 1.45
immediate_just(1,2)+first()+subscribe 4219.35 ns 0.61 ns 0.23 ns 2.60
immediate_just(1,2)+last()+subscribe 4312.35 ns 0.35 ns 0.26 ns 1.33
immediate_just+take_last(1)+subscribe 3710.79 ns 0.52 ns 0.28 ns 1.85
immediate_just(1,2,3)+element_at(1)+subscribe 3147.60 ns 0.59 ns 0.28 ns 2.10

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 1070.52 ns 6.87 ns 4.11 ns 1.67
current_thread scheduler create worker + schedule 1839.68 ns 44.11 ns 38.37 ns 1.15
current_thread scheduler create worker + schedule + recursive schedule 2436.21 ns 232.56 ns 206.36 ns 1.13

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 2368.17 ns 6.34 ns 5.05 ns 1.26
immediate_just+scan(10, std::plus)+subscribe 3768.56 ns 0.52 ns 0.54 ns 0.96
immediate_just+flat_map(immediate_just(v*2))+subscribe 8034.17 ns 992.30 ns 404.08 ns 2.46
immediate_just+buffer(2)+subscribe 3993.44 ns 116.69 ns 64.78 ns 1.80
immediate_just+window(2)+subscribe + subscsribe inner 8358.75 ns 3128.91 ns 2548.52 ns 1.23

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 2380.34 ns - - 0.00
immediate_just+take_while(true)+subscribe 2516.18 ns 0.26 ns 0.23 ns 1.12

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 8092.30 ns 6.99 ns 5.54 ns 1.26

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 11960.00 ns 971.35 ns 439.76 ns 2.21
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 12223.99 ns 710.42 ns 440.39 ns 1.61
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 691.81 ns 498.12 ns 1.39
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 11810.26 ns 2821.51 ns 2010.22 ns 1.40
immediate_just(1) + zip(immediate_just(2)) + subscribe 7435.54 ns 1298.90 ns 834.94 ns 1.56

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 100.22 ns 57.78 ns 55.47 ns 1.04
subscribe 100 observers to publish_subject 544758.00 ns 60443.29 ns 45958.00 ns 1.32
100 on_next to 100 observers to publish_subject 91542.09 ns 30911.60 ns 21626.32 ns 1.43

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 4312.29 ns 108.75 ns 80.86 ns 1.34
basic sample with immediate scheduler 5567.93 ns 31.45 ns 22.14 ns 1.42

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 3649.37 ns 0.31 ns 0.28 ns 1.11

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 7883.91 ns 8170.08 ns 4580.18 ns 1.78
create(on_error())+retry(1)+subscribe 2976.50 ns 574.37 ns 294.48 ns 1.95

ci-ubuntu-clang

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 274.77 ns 1.55 ns 1.57 ns 0.99
Subscribe empty callbacks to empty observable via pipe operator 270.71 ns 1.55 ns 1.56 ns 1.00

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 575.86 ns 0.31 ns 0.31 ns 1.01
from array of 1 - create + subscribe + current_thread 805.24 ns 4.04 ns 4.33 ns 0.93
concat_as_source of just(1 immediate) create + subscribe 2379.54 ns 197.00 ns 131.79 ns 1.49
defer from array of 1 - defer + create + subscribe + immediate 777.99 ns 0.31 ns 0.31 ns 1.01
interval - interval + take(3) + subscribe + immediate 2214.08 ns 58.69 ns 58.26 ns 1.01
interval - interval + take(3) + subscribe + current_thread 3202.93 ns 31.12 ns 30.86 ns 1.01
from array of 1 - create + as_blocking + subscribe + new_thread 30450.53 ns 34362.29 ns 35202.59 ns 0.98
from array of 1000 - create + as_blocking + subscribe + new_thread 40803.41 ns 40554.17 ns 41525.30 ns 0.98
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 3691.86 ns 319.17 ns 149.63 ns 2.13

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1185.40 ns 0.31 ns 0.31 ns 1.01
immediate_just+filter(true)+subscribe 840.36 ns 0.31 ns 0.31 ns 1.01
immediate_just(1,2)+skip(1)+subscribe 1089.88 ns 0.31 ns 0.31 ns 1.01
immediate_just(1,1,2)+distinct_until_changed()+subscribe 874.78 ns 0.32 ns 0.31 ns 1.03
immediate_just(1,2)+first()+subscribe 1403.60 ns 0.31 ns 0.31 ns 1.01
immediate_just(1,2)+last()+subscribe 1009.79 ns 0.31 ns 0.31 ns 1.01
immediate_just+take_last(1)+subscribe 1193.26 ns 0.31 ns 0.31 ns 1.01
immediate_just(1,2,3)+element_at(1)+subscribe 862.16 ns 0.31 ns 0.31 ns 1.01

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 278.34 ns 1.55 ns 1.56 ns 0.99
current_thread scheduler create worker + schedule 391.63 ns 4.60 ns 4.94 ns 0.93
current_thread scheduler create worker + schedule + recursive schedule 859.77 ns 61.36 ns 55.77 ns 1.10

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 842.51 ns 0.31 ns 0.31 ns 1.01
immediate_just+scan(10, std::plus)+subscribe 960.28 ns 0.62 ns 0.31 ns 2.01
immediate_just+flat_map(immediate_just(v*2))+subscribe 2289.88 ns 176.87 ns 137.52 ns 1.29
immediate_just+buffer(2)+subscribe 1578.70 ns 13.68 ns 13.58 ns 1.01
immediate_just+window(2)+subscribe + subscsribe inner 2485.26 ns 1016.20 ns 955.31 ns 1.06

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 833.13 ns - - 0.00
immediate_just+take_while(true)+subscribe 849.75 ns 0.31 ns 0.31 ns 1.01

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 1984.84 ns 0.31 ns 0.31 ns 1.01

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 3276.78 ns 202.50 ns 158.27 ns 1.28
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3825.83 ns 162.92 ns 145.99 ns 1.12
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 199.19 ns 143.48 ns 1.39
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3385.07 ns 843.84 ns 843.78 ns 1.00
immediate_just(1) + zip(immediate_just(2)) + subscribe 2287.03 ns 162.90 ns 201.13 ns 0.81

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 54.36 ns 17.80 ns 17.52 ns 1.02
subscribe 100 observers to publish_subject 213934.40 ns 16122.52 ns 16102.09 ns 1.00
100 on_next to 100 observers to publish_subject 35528.21 ns 17709.69 ns 20592.25 ns 0.86

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1319.46 ns 11.18 ns 11.72 ns 0.95
basic sample with immediate scheduler 1301.22 ns 5.94 ns 6.17 ns 0.96

Aggregating Operators

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

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 2193.85 ns 1034.08 ns 1240.12 ns 0.83
create(on_error())+retry(1)+subscribe 652.82 ns 158.76 ns 138.40 ns 1.15

ci-windows

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 560.19 ns 4.94 ns 4.01 ns 1.23
Subscribe empty callbacks to empty observable via pipe operator 580.91 ns 4.94 ns 4.01 ns 1.23

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 1192.44 ns 9.71 ns 9.63 ns 1.01
from array of 1 - create + subscribe + current_thread 1477.39 ns 17.60 ns 17.91 ns 0.98
concat_as_source of just(1 immediate) create + subscribe 3743.28 ns 249.08 ns 189.21 ns 1.32
defer from array of 1 - defer + create + subscribe + immediate 1200.10 ns 9.41 ns 9.41 ns 1.00
interval - interval + take(3) + subscribe + immediate 2960.40 ns 144.40 ns 145.29 ns 0.99
interval - interval + take(3) + subscribe + current_thread 3500.92 ns 65.46 ns 65.06 ns 1.01
from array of 1 - create + as_blocking + subscribe + new_thread 122711.11 ns 107710.00 ns 113920.00 ns 0.95
from array of 1000 - create + as_blocking + subscribe + new_thread 131562.50 ns 128537.50 ns 121444.44 ns 1.06
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 5355.87 ns 319.22 ns 207.64 ns 1.54

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1859.27 ns 24.99 ns 25.30 ns 0.99
immediate_just+filter(true)+subscribe 1320.91 ns 24.06 ns 25.50 ns 0.94
immediate_just(1,2)+skip(1)+subscribe 1751.99 ns 23.45 ns 24.07 ns 0.97
immediate_just(1,1,2)+distinct_until_changed()+subscribe 1381.77 ns 26.24 ns 29.01 ns 0.90
immediate_just(1,2)+first()+subscribe 2407.29 ns 23.74 ns 23.38 ns 1.02
immediate_just(1,2)+last()+subscribe 1816.22 ns 24.69 ns 24.07 ns 1.03
immediate_just+take_last(1)+subscribe 2045.33 ns 71.19 ns 128.77 ns 0.55
immediate_just(1,2,3)+element_at(1)+subscribe 1360.05 ns 26.52 ns 27.46 ns 0.97

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 493.56 ns 6.18 ns 6.18 ns 1.00
current_thread scheduler create worker + schedule 678.03 ns 14.08 ns 14.19 ns 0.99
current_thread scheduler create worker + schedule + recursive schedule 1399.87 ns 103.65 ns 104.44 ns 0.99

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 1361.14 ns 24.36 ns 24.35 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 1476.73 ns 26.51 ns 26.84 ns 0.99
immediate_just+flat_map(immediate_just(v*2))+subscribe 3630.17 ns 361.81 ns 204.70 ns 1.77
immediate_just+buffer(2)+subscribe 2600.24 ns 69.50 ns 71.11 ns 0.98
immediate_just+window(2)+subscribe + subscsribe inner 4031.12 ns 1333.29 ns 1277.04 ns 1.04

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 1352.37 ns 23.12 ns 23.12 ns 1.00
immediate_just+take_while(true)+subscribe 1361.19 ns 24.05 ns 24.36 ns 0.99

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 3648.89 ns 11.11 ns 11.11 ns 1.00

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 5175.93 ns 422.03 ns 224.47 ns 1.88
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 5461.46 ns 324.67 ns 211.43 ns 1.54
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 306.89 ns 197.55 ns 1.55
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 5343.01 ns 984.48 ns 923.25 ns 1.07
immediate_just(1) + zip(immediate_just(2)) + subscribe 3630.40 ns 543.51 ns 536.47 ns 1.01

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 37.55 ns 20.36 ns 20.66 ns 0.99
subscribe 100 observers to publish_subject 266925.00 ns 27391.89 ns 30131.58 ns 0.91
100 on_next to 100 observers to publish_subject 52390.91 ns 40062.96 ns 38819.23 ns 1.03

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1864.89 ns 101.50 ns 102.37 ns 0.99
basic sample with immediate scheduler 1868.86 ns 71.99 ns 74.11 ns 0.97

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 1530.83 ns 24.66 ns 24.97 ns 0.99

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 2220.55 ns 245.87 ns 349.11 ns 0.70
create(on_error())+retry(1)+subscribe 1193.25 ns 199.79 ns 185.37 ns 1.08

Copy link

codecov bot commented Sep 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.46%. Comparing base (0f86e39) to head (d0d978e).
Report is 1 commits behind head on v2.

Additional details and impacted files
@@           Coverage Diff           @@
##               v2     #643   +/-   ##
=======================================
  Coverage   95.45%   95.46%           
=======================================
  Files          97       97           
  Lines        1850     1851    +1     
=======================================
+ Hits         1766     1767    +1     
  Misses         84       84           

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

Copy link

@victimsnino victimsnino marked this pull request as ready for review September 20, 2024 06:24
@victimsnino victimsnino merged commit 6b5b2b8 into v2 Sep 20, 2024
7 checks passed
@victimsnino victimsnino deleted the static_asserts_2 branch September 20, 2024 06:24
@coderabbitai coderabbitai bot mentioned this pull request Oct 2, 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.

1 participant