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

fix new_thread join #646

Merged
merged 4 commits into from
Sep 25, 2024
Merged

fix new_thread join #646

merged 4 commits into from
Sep 25, 2024

Conversation

victimsnino
Copy link
Owner

@victimsnino victimsnino commented Sep 22, 2024

Fix #645

Summary by CodeRabbit

  • New Features

    • Simplified thread management by ensuring threads are always detached.
  • Bug Fixes

    • Enhanced test case structure in the scheduler tests for better clarity and synchronization.
  • Refactor

    • Updated the wait function in mock observer to accept a more generic template for expectations.

Copy link
Contributor

coderabbitai bot commented Sep 22, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes involve modifications to the thread lifecycle management in the new_thread.hpp file, simplifying the logic for detaching threads. Additionally, updates were made to a test case in test_scheduler.cpp, enhancing the structure and clarity of the test. The wait function in mock_observer was also made more generic in rpp_trompeloil.hpp, allowing it to handle various types of expectations.

Changes

Files Change Summary
src/rpp/rpp/schedulers/new_thread.hpp Simplified thread detachment logic by removing conditional checks.
src/tests/rpp/test_scheduler.cpp Updated test case structure, modified observer type, and changed value source.
src/tests/utils/rpp_trompeloil.hpp Made wait function more generic by updating its signature to accept any type.

Assessment against linked issues

Objective Addressed Explanation
Connect example output different than expected (#645) The changes do not address the output issue.

Poem

In the threads where rabbits hop,
We’ve made our code a little top!
With tests now clearer, oh so bright,
We dance in joy, our code's delight!
Hopping free, no checks to bind,
In the land of code, new paths we find! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 12e7c29 and eb4e94f.

📒 Files selected for processing (1)
  • src/tests/rpp/test_scheduler.cpp (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tests/rpp/test_scheduler.cpp

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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6b5b2b8 and 12e7c29.

Files selected for processing (3)
  • src/rpp/rpp/schedulers/new_thread.hpp (1 hunks)
  • src/tests/rpp/test_scheduler.cpp (2 hunks)
  • src/tests/utils/rpp_trompeloil.hpp (1 hunks)
Additional comments not posted (3)
src/tests/utils/rpp_trompeloil.hpp (1)

78-79: LGTM!

The change in function signature to accept a templated std::unique_ptr<T> instead of a std::unique_ptr<trompeloeil::expectation> makes the function more generic and reusable. The internal logic remains unchanged, and the function continues to wait for the expectation to be satisfied.

Since this function is used in test code and does not affect the production code, the change is safe and can be approved.

src/tests/rpp/test_scheduler.cpp (2)

739-740: LGTM!

The change in the mock type from mock_observer_strategy<int> to mock_observer<int> looks good.


742-754: Test structure and clarity enhancements look good!

The changes made to the test case improve its structure and clarity:

  • The introduction of the trompeloeil::sequence object s allows for defining the expected sequence of calls, making the test more readable and maintainable.
  • The usage of std::array to hold the test values enhances the readability and maintainability of the test.
  • The updated REQUIRE_CALL for on_next_lvalue now expects 10 calls in sequence, matching the size of the vals array, ensuring the correct number of calls.
  • Capturing the call to on_completed() in the last variable and making it part of the sequence ensures the proper order of calls.
  • The change in the source of values from rpp::source::just to rpp::source::from_iterable aligns with the usage of the vals array.
  • The final check on last not being satisfied and the addition of the wait(last) call ensures that the test waits for the completion of the sequence before concluding.

Overall, these changes enhance the test's structure, readability, and maintainability.

src/rpp/rpp/schedulers/new_thread.hpp Show resolved Hide resolved
Copy link
Contributor

BENCHMARK RESULTS (AUTOGENERATED)

ci-ubuntu-gcc

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 302.10 ns 2.22 ns 2.19 ns 1.01
Subscribe empty callbacks to empty observable via pipe operator 303.30 ns 2.18 ns 2.18 ns 1.00

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 690.37 ns 0.31 ns 0.31 ns 1.00
from array of 1 - create + subscribe + current_thread 1047.01 ns 3.73 ns 3.73 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 2249.36 ns 150.47 ns 155.27 ns 0.97
defer from array of 1 - defer + create + subscribe + immediate 732.11 ns 0.31 ns 0.31 ns 1.00
interval - interval + take(3) + subscribe + immediate 2110.19 ns 59.58 ns 59.62 ns 1.00
interval - interval + take(3) + subscribe + current_thread 2997.25 ns 32.65 ns 32.64 ns 1.00
from array of 1 - create + as_blocking + subscribe + new_thread 27936.21 ns 30470.15 ns 33076.03 ns 0.92
from array of 1000 - create + as_blocking + subscribe + new_thread 43523.88 ns 53794.00 ns 58521.24 ns 0.92
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 3498.90 ns 245.47 ns 214.67 ns 1.14

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1097.64 ns 0.31 ns 0.31 ns 1.00
immediate_just+filter(true)+subscribe 865.74 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1138.71 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 1067.29 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+first()+subscribe 1307.60 ns 0.31 ns 0.62 ns 0.50
immediate_just(1,2)+last()+subscribe 912.19 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 1128.18 ns 18.03 ns 17.71 ns 1.02
immediate_just(1,2,3)+element_at(1)+subscribe 864.62 ns 0.31 ns 0.31 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 273.55 ns 2.17 ns 2.18 ns 1.00
current_thread scheduler create worker + schedule 365.80 ns 5.59 ns 5.91 ns 0.95
current_thread scheduler create worker + schedule + recursive schedule 814.14 ns 56.38 ns 56.45 ns 1.00

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 851.19 ns 0.31 ns 0.31 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 913.67 ns 0.31 ns 0.31 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 2359.22 ns 210.47 ns 205.91 ns 1.02
immediate_just+buffer(2)+subscribe 1537.27 ns 13.67 ns 13.99 ns 0.98
immediate_just+window(2)+subscribe + subscsribe inner 2426.05 ns 1340.15 ns 1310.42 ns 1.02

Conditional Operators

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

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 2023.31 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 3514.15 ns 260.50 ns 253.38 ns 1.03
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3701.93 ns 206.70 ns 203.07 ns 1.02
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 179.81 ns 181.18 ns 0.99
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3588.16 ns 1329.30 ns 1207.02 ns 1.10
immediate_just(1) + zip(immediate_just(2)) + subscribe 2118.19 ns 203.18 ns 196.17 ns 1.04

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 34.73 ns 14.82 ns 14.74 ns 1.01
subscribe 100 observers to publish_subject 201189.40 ns 16164.93 ns 18045.06 ns 0.90
100 on_next to 100 observers to publish_subject 33136.66 ns 17403.12 ns 17266.79 ns 1.01

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1399.35 ns 14.00 ns 13.08 ns 1.07
basic sample with immediate scheduler 1400.89 ns 5.59 ns 5.59 ns 1.00

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 937.17 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 2076.92 ns 934.86 ns 918.29 ns 1.02
create(on_error())+retry(1)+subscribe 587.58 ns 124.37 ns 123.40 ns 1.01

ci-macos

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 1021.71 ns 4.13 ns 3.96 ns 1.04
Subscribe empty callbacks to empty observable via pipe operator 974.16 ns 3.91 ns 3.94 ns 0.99

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 1935.25 ns 0.23 ns 0.23 ns 1.00
from array of 1 - create + subscribe + current_thread 2499.47 ns 35.29 ns 32.62 ns 1.08
concat_as_source of just(1 immediate) create + subscribe 6028.30 ns 612.62 ns 422.25 ns 1.45
defer from array of 1 - defer + create + subscribe + immediate 2556.33 ns 0.27 ns 0.23 ns 1.14
interval - interval + take(3) + subscribe + immediate 6181.43 ns 126.27 ns 113.07 ns 1.12
interval - interval + take(3) + subscribe + current_thread 7259.04 ns 139.95 ns 96.91 ns 1.44
from array of 1 - create + as_blocking + subscribe + new_thread 94536.45 ns 104675.55 ns 94964.33 ns 1.10
from array of 1000 - create + as_blocking + subscribe + new_thread 94796.27 ns 96881.00 ns 95914.91 ns 1.01
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 9130.90 ns 638.99 ns 586.46 ns 1.09

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 3267.38 ns 0.32 ns 0.24 ns 1.32
immediate_just+filter(true)+subscribe 2186.88 ns 0.24 ns 0.24 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 3044.07 ns 0.27 ns 0.23 ns 1.14
immediate_just(1,1,2)+distinct_until_changed()+subscribe 2380.68 ns 0.50 ns 0.47 ns 1.07
immediate_just(1,2)+first()+subscribe 3313.34 ns 0.24 ns 0.24 ns 1.02
immediate_just(1,2)+last()+subscribe 2697.10 ns 0.27 ns 0.23 ns 1.17
immediate_just+take_last(1)+subscribe 3117.41 ns 0.27 ns 0.24 ns 1.12
immediate_just(1,2,3)+element_at(1)+subscribe 2374.64 ns 0.25 ns 0.23 ns 1.07

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 921.76 ns 5.74 ns 4.11 ns 1.40
current_thread scheduler create worker + schedule 1540.50 ns 46.13 ns 40.54 ns 1.14
current_thread scheduler create worker + schedule + recursive schedule 2220.50 ns 232.42 ns 200.78 ns 1.16

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 2231.76 ns 4.82 ns 4.43 ns 1.09
immediate_just+scan(10, std::plus)+subscribe 2499.63 ns 0.50 ns 0.47 ns 1.08
immediate_just+flat_map(immediate_just(v*2))+subscribe 5642.98 ns 659.16 ns 623.58 ns 1.06
immediate_just+buffer(2)+subscribe 2827.42 ns 78.12 ns 66.01 ns 1.18
immediate_just+window(2)+subscribe + subscsribe inner 5829.54 ns 2592.93 ns 2468.52 ns 1.05

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 2296.65 ns - - 0.00
immediate_just+take_while(true)+subscribe 2390.96 ns 0.36 ns 0.23 ns 1.56

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 5216.95 ns 5.29 ns 4.68 ns 1.13

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 7823.63 ns 800.86 ns 746.73 ns 1.07
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 8824.71 ns 624.98 ns 600.90 ns 1.04
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 606.11 ns 567.20 ns 1.07
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 9386.89 ns 2246.24 ns 1863.01 ns 1.21
immediate_just(1) + zip(immediate_just(2)) + subscribe 5595.52 ns 1042.05 ns 778.11 ns 1.34

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 83.04 ns 51.93 ns 46.97 ns 1.11
subscribe 100 observers to publish_subject 394238.00 ns 43750.85 ns 39042.86 ns 1.12
100 on_next to 100 observers to publish_subject 58370.94 ns 20708.06 ns 17306.08 ns 1.20

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 3142.26 ns 72.67 ns 61.60 ns 1.18
basic sample with immediate scheduler 3142.04 ns 20.43 ns 19.45 ns 1.05

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 2579.86 ns 0.25 ns 0.22 ns 1.10

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 7224.05 ns 4158.61 ns 3712.87 ns 1.12
create(on_error())+retry(1)+subscribe 1986.59 ns 384.57 ns 344.68 ns 1.12

ci-ubuntu-clang

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 274.21 ns 0.88 ns 1.60 ns 0.55
Subscribe empty callbacks to empty observable via pipe operator 271.11 ns 0.88 ns 1.59 ns 0.56

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 568.31 ns 0.31 ns 0.31 ns 1.00
from array of 1 - create + subscribe + current_thread 803.02 ns 4.35 ns 4.35 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 2355.08 ns 181.49 ns 193.37 ns 0.94
defer from array of 1 - defer + create + subscribe + immediate 789.25 ns 0.31 ns 0.32 ns 0.98
interval - interval + take(3) + subscribe + immediate 2250.35 ns 58.97 ns 58.68 ns 1.01
interval - interval + take(3) + subscribe + current_thread 3249.83 ns 31.28 ns 31.07 ns 1.01
from array of 1 - create + as_blocking + subscribe + new_thread 29975.49 ns 30596.71 ns 33864.30 ns 0.90
from array of 1000 - create + as_blocking + subscribe + new_thread 40626.62 ns 37197.71 ns 39482.71 ns 0.94
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 3605.51 ns 302.18 ns 302.75 ns 1.00

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1152.88 ns 0.31 ns 0.31 ns 1.01
immediate_just+filter(true)+subscribe 859.05 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1076.81 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 873.03 ns 0.62 ns 0.62 ns 1.00
immediate_just(1,2)+first()+subscribe 1432.12 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+last()+subscribe 1004.82 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 1196.97 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2,3)+element_at(1)+subscribe 865.41 ns 0.31 ns 0.31 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 284.30 ns 0.89 ns 1.59 ns 0.56
current_thread scheduler create worker + schedule 401.60 ns 5.07 ns 4.97 ns 1.02
current_thread scheduler create worker + schedule + recursive schedule 861.68 ns 56.03 ns 58.07 ns 0.96

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 859.73 ns 0.31 ns 0.31 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 971.66 ns 0.33 ns 0.33 ns 1.01
immediate_just+flat_map(immediate_just(v*2))+subscribe 2262.24 ns 174.19 ns 177.29 ns 0.98
immediate_just+buffer(2)+subscribe 1519.66 ns 13.98 ns 14.29 ns 0.98
immediate_just+window(2)+subscribe + subscsribe inner 2452.16 ns 946.65 ns 945.07 ns 1.00

Conditional Operators

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

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 2111.84 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 3233.64 ns 202.14 ns 204.32 ns 0.99
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3720.39 ns 162.14 ns 161.43 ns 1.00
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 199.09 ns 198.87 ns 1.00
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3424.86 ns 857.19 ns 856.18 ns 1.00
immediate_just(1) + zip(immediate_just(2)) + subscribe 2280.86 ns 162.75 ns 159.84 ns 1.02

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 52.52 ns 17.92 ns 17.90 ns 1.00
subscribe 100 observers to publish_subject 213717.20 ns 16158.36 ns 16141.11 ns 1.00
100 on_next to 100 observers to publish_subject 38400.77 ns 20589.42 ns 17485.91 ns 1.18

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1312.87 ns 11.80 ns 11.80 ns 1.00
basic sample with immediate scheduler 1354.92 ns 6.21 ns 6.21 ns 1.00

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 995.09 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 2213.54 ns 1049.17 ns 1026.90 ns 1.02
create(on_error())+retry(1)+subscribe 662.78 ns 156.96 ns 158.44 ns 0.99

ci-windows

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 559.06 ns 4.32 ns 4.79 ns 0.90
Subscribe empty callbacks to empty observable via pipe operator 574.62 ns 4.32 ns 4.74 ns 0.91

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 1143.90 ns 9.71 ns 9.71 ns 1.00
from array of 1 - create + subscribe + current_thread 1414.46 ns 17.91 ns 18.09 ns 0.99
concat_as_source of just(1 immediate) create + subscribe 3732.36 ns 245.50 ns 240.37 ns 1.02
defer from array of 1 - defer + create + subscribe + immediate 1176.73 ns 9.42 ns 9.42 ns 1.00
interval - interval + take(3) + subscribe + immediate 3084.68 ns 145.44 ns 144.31 ns 1.01
interval - interval + take(3) + subscribe + current_thread 3414.63 ns 65.95 ns 65.59 ns 1.01
from array of 1 - create + as_blocking + subscribe + new_thread 124877.78 ns 116033.33 ns 118900.00 ns 0.98
from array of 1000 - create + as_blocking + subscribe + new_thread 133750.00 ns 134187.50 ns 137300.00 ns 0.98
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 5341.79 ns 315.50 ns 310.71 ns 1.02

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1818.26 ns 25.30 ns 24.97 ns 1.01
immediate_just+filter(true)+subscribe 1325.97 ns 24.35 ns 24.05 ns 1.01
immediate_just(1,2)+skip(1)+subscribe 1733.55 ns 24.07 ns 23.44 ns 1.03
immediate_just(1,1,2)+distinct_until_changed()+subscribe 1349.06 ns 28.99 ns 26.23 ns 1.11
immediate_just(1,2)+first()+subscribe 2377.75 ns 22.82 ns 23.74 ns 0.96
immediate_just(1,2)+last()+subscribe 1796.52 ns 24.06 ns 24.69 ns 0.97
immediate_just+take_last(1)+subscribe 1999.83 ns 72.58 ns 70.12 ns 1.04
immediate_just(1,2,3)+element_at(1)+subscribe 1333.55 ns 27.44 ns 26.53 ns 1.03

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 474.23 ns 6.48 ns 6.48 ns 1.00
current_thread scheduler create worker + schedule 642.53 ns 13.95 ns 14.55 ns 0.96
current_thread scheduler create worker + schedule + recursive schedule 1348.35 ns 106.87 ns 105.92 ns 1.01

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 1305.42 ns 24.37 ns 24.35 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 1424.63 ns 26.55 ns 26.51 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 3487.76 ns 347.48 ns 350.40 ns 0.99
immediate_just+buffer(2)+subscribe 2586.15 ns 68.83 ns 68.45 ns 1.01
immediate_just+window(2)+subscribe + subscsribe inner 3992.55 ns 1298.61 ns 1287.00 ns 1.01

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 1315.65 ns 23.14 ns 23.12 ns 1.00
immediate_just+take_while(true)+subscribe 1321.22 ns 24.37 ns 24.05 ns 1.01

Utility Operators

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

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 5102.23 ns 418.77 ns 421.48 ns 0.99
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 5448.98 ns 329.82 ns 322.26 ns 1.02
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 301.75 ns 300.54 ns 1.00
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 5251.55 ns 947.06 ns 962.29 ns 0.98
immediate_just(1) + zip(immediate_just(2)) + subscribe 3585.71 ns 554.70 ns 544.96 ns 1.02

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 37.77 ns 19.49 ns 19.47 ns 1.00
subscribe 100 observers to publish_subject 261175.00 ns 28340.48 ns 28694.29 ns 0.99
100 on_next to 100 observers to publish_subject 48700.00 ns 32561.29 ns 35613.79 ns 0.91

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1903.14 ns 101.45 ns 101.31 ns 1.00
basic sample with immediate scheduler 1890.64 ns 73.99 ns 74.28 ns 1.00

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 1460.22 ns 24.97 ns 24.66 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 2163.07 ns 263.63 ns 263.77 ns 1.00
create(on_error())+retry(1)+subscribe 1178.83 ns 194.57 ns 196.13 ns 0.99

Copy link

@victimsnino victimsnino merged commit 9c328ba into v2 Sep 25, 2024
35 checks passed
@victimsnino victimsnino deleted the fix_new_thread_join branch September 25, 2024 19:39
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.

Connect example output different than expected
2 participants