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 disposables docs #679

Merged
merged 4 commits into from
Nov 14, 2024
Merged

Update disposables docs #679

merged 4 commits into from
Nov 14, 2024

Conversation

victimsnino
Copy link
Owner

@victimsnino victimsnino commented Nov 10, 2024

Summary by CodeRabbit

  • Documentation
    • Enhanced clarity and detail in the Reactive Programming documentation, covering core concepts, error handling, and resource management.
    • Expanded explanations of the Disposable class, detailing upstream and external disposables.
    • Improved documentation for the disposable_wrapper class, emphasizing its role as a smart pointer for disposables and providing clearer usage examples.

Copy link
Contributor

coderabbitai bot commented Nov 10, 2024

📝 Walkthrough

Walkthrough

The documentation for Reactive Programming has been extensively updated to improve clarity and detail. Key areas include an enhanced introduction to reactive programming, expanded descriptions of Observer and Observable patterns, and refined sections on data handling strategies. The Disposable class documentation has also been revised to clarify its role in resource management. Additionally, the disposable_wrapper class documentation has been overhauled to emphasize ownership semantics and lifecycle management. Overall, the changes aim to provide a more comprehensive understanding of reactive programming principles.

Changes

File Path Change Summary
docs/readme.md Updated documentation for Reactive Programming, including core concepts, error handling, and memory management. Enhanced sections on Disposable and advanced details on disposable-related classes.
src/rpp/rpp/disposables.hpp Revised documentation for the Disposable class, clarifying its purpose in resource management and detailing upstream and external disposables.
src/rpp/rpp/disposables/disposable_wrapper.hpp Overhauled documentation for the disposable_wrapper class, emphasizing its role as a smart pointer, ownership semantics, and lifecycle management of disposables. Expanded descriptions for methods.

Possibly related issues

Possibly related PRs

  • Fix disposables issue #640: The changes in this PR address issues related to the disposal of disposables, which is directly relevant to the updates made in the main PR regarding the documentation of the Disposable class and its management within reactive programming.
  • refactor concat to speedup it #677: This PR involves modifications to the concat_disposable class, which is related to the management of disposables in the context of the concat operator, aligning with the main PR's focus on enhancing the understanding of disposables in reactive programming.

Poem

🐇 In the land of code where rabbits play,
Documentation blooms in a vibrant display.
With disposables wrapped in a cozy embrace,
Reactive patterns dance, keeping up the pace.
Clarity reigns, as knowledge takes flight,
Hopping through changes, oh what a delight! 🌟


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: 0

🧹 Outside diff range and nitpick comments (5)
src/rpp/rpp/disposables.hpp (2)

18-21: Consider adding code examples to illustrate resource management.

While the detailed explanation is clear, adding simple code examples would help developers better understand how disposables manage different types of resources in practice.

Consider adding examples like:

// Example of managing a network connection
auto connection = observable.subscribe_with_disposable([](const auto& data) {
    // Process data
});
// Later, when done
connection.dispose(); // Cleanly closes the connection

33-34: Consider expanding the implementation note.

While the note about using disposable_wrapper_impl is important, it could be more helpful to explain why this is the recommended approach (e.g., automatic resource management, exception safety).

Consider expanding the note:

- @note In rpp all disposables should be created via @link rpp::disposable_wrapper_impl @endlink instead of manually.
+ @note In rpp all disposables should be created via @link rpp::disposable_wrapper_impl @endlink instead of manually.
+ This ensures proper resource management with RAII semantics and exception safety.
+ It also helps prevent common issues like memory leaks or use-after-free errors.
src/rpp/rpp/disposables/disposable_wrapper.hpp (2)

108-136: Documentation improvements look great! Consider adding thread-safety details.

The documentation updates significantly improve clarity by explaining the smart pointer nature, ownership semantics, and providing practical examples. The relationship with subscribe methods is well explained.

Consider adding:

  • Thread-safety guarantees for concurrent access
  • Performance characteristics of key operations

155-160: Consider documenting allocation and exception behavior.

The documentation clearly explains the purpose and provides a good example. Consider adding:

  • Memory allocation behavior
  • Exception safety guarantees
docs/readme.md (1)

Line range hint 341-356: Enhance the disposables documentation with lifecycle examples.

The documentation for disposables is comprehensive but could be improved by:

  1. Adding a code example demonstrating the lifecycle management using disposable_wrapper_impl.
  2. Including a practical example showing the difference between disposable_wrapper and composite_disposable_wrapper.

Consider adding examples like:

// Example of disposable lifecycle management
auto disposable = rpp::make_callback_disposable([]() noexcept {
    std::cout << "Resource cleanup" << std::endl;
});
{
    rpp::disposable_wrapper wrapper{std::move(disposable)};
    // wrapper automatically calls dispose() when going out of scope
}

// Example of composite disposable
auto composite = rpp::composite_disposable_wrapper{};
composite.add(rpp::make_callback_disposable([]() noexcept {
    std::cout << "Cleanup 1" << std::endl;
}));
composite.add(rpp::make_callback_disposable([]() noexcept {
    std::cout << "Cleanup 2" << std::endl;
}));
// Both cleanup callbacks will be called when composite is disposed
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 37e4949 and 90fdb5a.

📒 Files selected for processing (3)
  • docs/readme.md (1 hunks)
  • src/rpp/rpp/disposables.hpp (1 hunks)
  • src/rpp/rpp/disposables/disposable_wrapper.hpp (2 hunks)
🔇 Additional comments (3)
src/rpp/rpp/disposables.hpp (2)

15-16: LGTM! Clear and concise brief description.

The brief description effectively communicates the core purpose of a Disposable as a handle/resource in the observable-observer relationship.


23-32: Excellent explanation of disposable types!

The documentation clearly distinguishes between upstream and external disposables, providing a comprehensive understanding of their different purposes and use cases.

docs/readme.md (1)

196-198: Verify the Doxygen reference for disposables documentation.

The \copydoc disposables command is used to include documentation from another file. Let's verify this reference exists and is properly linked.

✅ Verification successful

The Doxygen reference for disposables is correctly set up and linked

The documentation reference is properly configured:

  • The @defgroup disposables is defined in src/rpp/rpp/disposables.hpp with comprehensive documentation
  • Multiple files are correctly linked to this group using @ingroup disposables
  • The \copydoc command in the readme correctly references this documentation group
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the disposables documentation reference exists in header files

# Test 1: Search for the disposables documentation group
rg -l '@defgroup disposables' src/

# Test 2: Search for related documentation
rg -l '@ingroup disposables' src/

Length of output: 325


Script:

#!/bin/bash
# Let's verify the actual content of the disposables documentation group
rg -A 5 '@defgroup disposables' src/rpp/rpp/disposables.hpp

# Also check the content around the \copydoc command in the readme
rg -A 5 '\\copydoc disposables' docs/readme.md

Length of output: 741

Copy link
Contributor

github-actions bot commented Nov 10, 2024

BENCHMARK RESULTS (AUTOGENERATED)

ci-ubuntu-gcc

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 304.21 ns 1.88 ns 1.85 ns 1.01
Subscribe empty callbacks to empty observable via pipe operator 304.03 ns 1.85 ns 1.85 ns 1.00

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 682.72 ns 0.31 ns 0.31 ns 1.00
from array of 1 - create + subscribe + current_thread 1051.98 ns 3.42 ns 3.43 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 2214.71 ns 112.17 ns 111.93 ns 1.00
defer from array of 1 - defer + create + subscribe + immediate 722.93 ns 0.31 ns 0.31 ns 1.00
interval - interval + take(3) + subscribe + immediate 2164.66 ns 59.19 ns 59.23 ns 1.00
interval - interval + take(3) + subscribe + current_thread 2967.29 ns 32.40 ns 32.40 ns 1.00
from array of 1 - create + as_blocking + subscribe + new_thread 27046.26 ns 27804.74 ns 28324.88 ns 0.98
from array of 1000 - create + as_blocking + subscribe + new_thread 39197.89 ns 49553.73 ns 51243.95 ns 0.97
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 3529.70 ns 130.24 ns 130.55 ns 1.00

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1094.95 ns 0.31 ns 0.31 ns 1.00
immediate_just+filter(true)+subscribe 889.79 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1005.12 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 859.96 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+first()+subscribe 1230.18 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+last()+subscribe 920.01 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 1170.01 ns 18.20 ns 17.91 ns 1.02
immediate_just(1,2,3)+element_at(1)+subscribe 876.68 ns 0.31 ns 0.31 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 264.05 ns 0.46 ns 0.46 ns 1.00
current_thread scheduler create worker + schedule 365.66 ns 4.32 ns 4.32 ns 1.00
current_thread scheduler create worker + schedule + recursive schedule 825.55 ns 60.96 ns 61.17 ns 1.00

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 886.76 ns 0.31 ns 0.31 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 875.96 ns 0.31 ns 0.31 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 2305.12 ns 138.97 ns 170.56 ns 0.81
immediate_just+buffer(2)+subscribe 1575.82 ns 13.89 ns 13.59 ns 1.02
immediate_just+window(2)+subscribe + subscsribe inner 2384.24 ns 1353.00 ns 1325.75 ns 1.02

Conditional Operators

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

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 1994.40 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 3392.98 ns 159.95 ns 203.76 ns 0.78
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3666.51 ns 160.69 ns 161.58 ns 0.99
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 133.19 ns 129.60 ns 1.03
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3558.32 ns 1160.82 ns 1165.96 ns 1.00
immediate_just(1) + zip(immediate_just(2)) + subscribe 2106.12 ns 210.25 ns 207.99 ns 1.01
immediate_just(immediate_just(1), immediate_just(1)) + concat() + subscribe 3158.00 ns 238.19 ns 239.54 ns 0.99

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 34.49 ns 14.66 ns 14.66 ns 1.00
subscribe 100 observers to publish_subject 198874.33 ns 15961.88 ns 16355.43 ns 0.98
100 on_next to 100 observers to publish_subject 27542.87 ns 17268.48 ns 19297.93 ns 0.89

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1411.64 ns 12.66 ns 12.65 ns 1.00
basic sample with immediate scheduler 1480.84 ns 5.24 ns 5.24 ns 1.00

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 908.80 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 2020.04 ns 988.59 ns 990.54 ns 1.00
create(on_error())+retry(1)+subscribe 607.18 ns 130.81 ns 115.34 ns 1.13

ci-macos

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 1010.42 ns 0.47 ns 0.60 ns 0.78
Subscribe empty callbacks to empty observable via pipe operator 1007.32 ns 0.47 ns 0.58 ns 0.82

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 1976.85 ns 0.24 ns 0.26 ns 0.89
from array of 1 - create + subscribe + current_thread 2502.09 ns 33.79 ns 38.65 ns 0.87
concat_as_source of just(1 immediate) create + subscribe 5505.64 ns 317.62 ns 351.67 ns 0.90
defer from array of 1 - defer + create + subscribe + immediate 1983.70 ns 0.23 ns 0.26 ns 0.91
interval - interval + take(3) + subscribe + immediate 4986.31 ns 114.10 ns 124.54 ns 0.92
interval - interval + take(3) + subscribe + current_thread 6076.83 ns 98.85 ns 106.40 ns 0.93
from array of 1 - create + as_blocking + subscribe + new_thread 89167.73 ns 89880.25 ns 95570.83 ns 0.94
from array of 1000 - create + as_blocking + subscribe + new_thread 87182.10 ns 87175.08 ns 103187.36 ns 0.84
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 8362.43 ns 361.65 ns 405.12 ns 0.89

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 2925.87 ns 0.24 ns 0.23 ns 1.01
immediate_just+filter(true)+subscribe 2136.09 ns 0.23 ns 0.23 ns 1.01
immediate_just(1,2)+skip(1)+subscribe 2786.82 ns 0.23 ns 0.23 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 2103.50 ns 0.47 ns 0.47 ns 1.00
immediate_just(1,2)+first()+subscribe 3247.28 ns 0.24 ns 0.23 ns 1.01
immediate_just(1,2)+last()+subscribe 2405.04 ns 0.23 ns 0.23 ns 1.00
immediate_just+take_last(1)+subscribe 3092.74 ns 0.23 ns 0.23 ns 1.01
immediate_just(1,2,3)+element_at(1)+subscribe 2152.72 ns 0.23 ns 0.29 ns 0.81

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 858.08 ns 0.94 ns 4.93 ns 0.19
current_thread scheduler create worker + schedule 1198.63 ns 34.14 ns 116.11 ns 0.29
current_thread scheduler create worker + schedule + recursive schedule 2017.68 ns 202.99 ns 226.20 ns 0.90

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 2121.67 ns 4.44 ns 4.20 ns 1.06
immediate_just+scan(10, std::plus)+subscribe 2363.88 ns 0.47 ns 0.47 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 5387.47 ns 374.93 ns 373.21 ns 1.00
immediate_just+buffer(2)+subscribe 2533.90 ns 64.06 ns 68.22 ns 0.94
immediate_just+window(2)+subscribe + subscsribe inner 5552.89 ns 2423.26 ns 2363.91 ns 1.03

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 2121.40 ns - - 0.00
immediate_just+take_while(true)+subscribe 2127.72 ns 0.23 ns 0.23 ns 1.01

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 4973.07 ns 4.92 ns 5.95 ns 0.83

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 8163.48 ns 431.00 ns 469.30 ns 0.92
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 8542.46 ns 409.60 ns 427.10 ns 0.96
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 453.02 ns 453.63 ns 1.00
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 8248.57 ns 1893.19 ns 1945.74 ns 0.97
immediate_just(1) + zip(immediate_just(2)) + subscribe 5249.77 ns 825.00 ns 827.10 ns 1.00
immediate_just(immediate_just(1), immediate_just(1)) + concat() + subscribe 7580.73 ns 665.04 ns 886.27 ns 0.75

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 75.41 ns 50.28 ns 53.14 ns 0.95
subscribe 100 observers to publish_subject 354452.00 ns 41217.11 ns 45833.83 ns 0.90
100 on_next to 100 observers to publish_subject 52877.00 ns 19418.38 ns 22447.80 ns 0.87

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 2794.41 ns 69.24 ns 78.27 ns 0.88
basic sample with immediate scheduler 2789.01 ns 18.76 ns 21.17 ns 0.89

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 2397.01 ns 0.23 ns 0.29 ns 0.80

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 6643.49 ns 4168.81 ns 4350.13 ns 0.96
create(on_error())+retry(1)+subscribe 1855.51 ns 280.26 ns 288.40 ns 0.97

ci-ubuntu-clang

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 272.21 ns 0.63 ns 1.54 ns 0.41
Subscribe empty callbacks to empty observable via pipe operator 311.05 ns 0.63 ns 1.54 ns 0.41

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 560.99 ns 0.31 ns 0.31 ns 1.00
from array of 1 - create + subscribe + current_thread 811.53 ns 4.01 ns 4.01 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 2334.53 ns 128.60 ns 129.51 ns 0.99
defer from array of 1 - defer + create + subscribe + immediate 773.49 ns 0.31 ns 0.31 ns 1.00
interval - interval + take(3) + subscribe + immediate 2215.17 ns 58.26 ns 58.26 ns 1.00
interval - interval + take(3) + subscribe + current_thread 3280.77 ns 30.88 ns 30.88 ns 1.00
from array of 1 - create + as_blocking + subscribe + new_thread 28239.00 ns 27554.49 ns 28296.37 ns 0.97
from array of 1000 - create + as_blocking + subscribe + new_thread 36118.79 ns 33852.82 ns 35617.48 ns 0.95
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 3647.61 ns 147.62 ns 147.42 ns 1.00

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1156.59 ns 0.31 ns 0.31 ns 1.00
immediate_just+filter(true)+subscribe 849.43 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1079.75 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 864.41 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+first()+subscribe 1368.68 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+last()+subscribe 997.61 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 1193.10 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2,3)+element_at(1)+subscribe 861.12 ns 0.31 ns 0.31 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 282.68 ns 1.54 ns 0.63 ns 2.43
current_thread scheduler create worker + schedule 391.41 ns 4.01 ns 4.32 ns 0.93
current_thread scheduler create worker + schedule + recursive schedule 854.17 ns 56.80 ns 54.88 ns 1.03

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 841.02 ns 0.31 ns 0.31 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 964.95 ns 0.62 ns 0.62 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 2249.35 ns 144.59 ns 142.77 ns 1.01
immediate_just+buffer(2)+subscribe 1505.77 ns 14.19 ns 14.20 ns 1.00
immediate_just+window(2)+subscribe + subscsribe inner 2452.76 ns 903.82 ns 911.43 ns 0.99

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 828.81 ns - - 0.00
immediate_just+take_while(true)+subscribe 862.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 1973.28 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 3275.18 ns 156.91 ns 155.72 ns 1.01
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3714.12 ns 139.82 ns 136.79 ns 1.02
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 143.34 ns 142.90 ns 1.00
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3371.73 ns 834.73 ns 827.38 ns 1.01
immediate_just(1) + zip(immediate_just(2)) + subscribe 2211.69 ns 206.04 ns 206.35 ns 1.00
immediate_just(immediate_just(1), immediate_just(1)) + concat() + subscribe 3200.16 ns 222.63 ns 224.94 ns 0.99

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 52.22 ns 17.94 ns 17.95 ns 1.00
subscribe 100 observers to publish_subject 217049.00 ns 16646.23 ns 16038.88 ns 1.04
100 on_next to 100 observers to publish_subject 38991.23 ns 23666.46 ns 20692.56 ns 1.14

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1317.96 ns 11.42 ns 11.42 ns 1.00
basic sample with immediate scheduler 1290.43 ns 6.17 ns 6.17 ns 1.00

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 980.56 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 2172.03 ns 1185.86 ns 1172.90 ns 1.01
create(on_error())+retry(1)+subscribe 638.02 ns 139.71 ns 139.15 ns 1.00

ci-windows

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 559.02 ns 1.85 ns 2.16 ns 0.86
Subscribe empty callbacks to empty observable via pipe operator 581.85 ns 1.85 ns 2.16 ns 0.86

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 1141.94 ns 5.55 ns 5.55 ns 1.00
from array of 1 - create + subscribe + current_thread 1415.21 ns 15.74 ns 15.74 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 3733.09 ns 172.47 ns 171.26 ns 1.01
defer from array of 1 - defer + create + subscribe + immediate 1186.40 ns 5.55 ns 5.55 ns 1.00
interval - interval + take(3) + subscribe + immediate 3403.57 ns 140.91 ns 140.00 ns 1.01
interval - interval + take(3) + subscribe + current_thread 3444.85 ns 59.23 ns 59.74 ns 0.99
from array of 1 - create + as_blocking + subscribe + new_thread 120770.00 ns 115320.00 ns 110990.00 ns 1.04
from array of 1000 - create + as_blocking + subscribe + new_thread 131155.56 ns 132911.11 ns 128987.50 ns 1.03
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 5305.33 ns 198.78 ns 196.48 ns 1.01

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1813.82 ns 19.73 ns 19.43 ns 1.02
immediate_just+filter(true)+subscribe 1621.71 ns 18.80 ns 18.51 ns 1.02
immediate_just(1,2)+skip(1)+subscribe 1746.77 ns 18.50 ns 17.90 ns 1.03
immediate_just(1,1,2)+distinct_until_changed()+subscribe 1350.33 ns 23.46 ns 20.68 ns 1.13
immediate_just(1,2)+first()+subscribe 2386.00 ns 17.28 ns 18.21 ns 0.95
immediate_just(1,2)+last()+subscribe 1482.96 ns 18.51 ns 19.14 ns 0.97
immediate_just+take_last(1)+subscribe 1998.29 ns 64.76 ns 65.06 ns 1.00
immediate_just(1,2,3)+element_at(1)+subscribe 1635.60 ns 21.90 ns 21.00 ns 1.04

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 478.87 ns 4.01 ns 4.01 ns 1.00
current_thread scheduler create worker + schedule 646.92 ns 11.62 ns 11.60 ns 1.00
current_thread scheduler create worker + schedule + recursive schedule 1343.37 ns 102.19 ns 104.05 ns 0.98

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 1311.31 ns 18.82 ns 18.82 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 1424.47 ns 21.29 ns 20.96 ns 1.02
immediate_just+flat_map(immediate_just(v*2))+subscribe 3817.39 ns 178.75 ns 204.01 ns 0.88
immediate_just+buffer(2)+subscribe 2309.83 ns 64.07 ns 65.36 ns 0.98
immediate_just+window(2)+subscribe + subscsribe inner 4022.75 ns 1289.32 ns 1322.29 ns 0.98

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 1304.62 ns 17.57 ns 17.57 ns 1.00
immediate_just+take_while(true)+subscribe 1317.44 ns 18.81 ns 18.51 ns 1.02

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 3235.82 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 5040.27 ns 195.25 ns 201.39 ns 0.97
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 5673.33 ns 185.88 ns 181.89 ns 1.02
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 213.40 ns 208.78 ns 1.02
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 6053.16 ns 948.97 ns 960.61 ns 0.99
immediate_just(1) + zip(immediate_just(2)) + subscribe 3810.93 ns 518.45 ns 510.38 ns 1.02
immediate_just(immediate_just(1), immediate_just(1)) + concat() + subscribe 4833.62 ns 339.13 ns 336.56 ns 1.01

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 36.81 ns 20.33 ns 20.12 ns 1.01
subscribe 100 observers to publish_subject 262600.00 ns 27533.33 ns 27373.68 ns 1.01
100 on_next to 100 observers to publish_subject 51835.00 ns 35736.67 ns 35759.38 ns 1.00

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1862.05 ns 96.09 ns 95.77 ns 1.00
basic sample with immediate scheduler 1876.75 ns 68.50 ns 68.43 ns 1.00

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 1444.67 ns 19.42 ns 19.13 ns 1.02

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 1901.73 ns 358.04 ns 354.01 ns 1.01
create(on_error())+retry(1)+subscribe 1571.23 ns 141.64 ns 140.22 ns 1.01

Co-authored-by: Markus Werle <daixtrose@users.noreply.github.com>
@victimsnino victimsnino marked this pull request as ready for review November 10, 2024 18:22
Copy link

codecov bot commented Nov 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.64%. Comparing base (37e4949) to head (dc67845).
Report is 1 commits behind head on v2.

Additional details and impacted files
@@           Coverage Diff           @@
##               v2     #679   +/-   ##
=======================================
  Coverage   98.64%   98.64%           
=======================================
  Files         155      155           
  Lines        9764     9764           
=======================================
  Hits         9632     9632           
  Misses        132      132           

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

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: 0

🧹 Outside diff range and nitpick comments (2)
src/rpp/rpp/disposables/disposable_wrapper.hpp (2)

108-136: Documentation improvements suggested for better clarity.

While the documentation is comprehensive, consider these enhancements:

  1. Make the code example on line 120 more concrete by showing a real disposable type (e.g., callback_disposable or composite_disposable).
  2. Clarify the performance consideration statement on line 123 by explaining the overhead of returning disposables.
  3. Add a brief type hierarchy diagram or explanation showing the relationship between interface_disposable, composite_disposable, and other disposable types.

155-160: Enhance make method documentation with more details.

Consider improving the documentation by:

  1. Expanding the code example to show constructor arguments:
// Example with constructor arguments
auto d = rpp::disposable_wrapper<rpp::interface_composite_disposable>::make<rpp::composite_disposable>(
    /* constructor args */
);
  1. Documenting the template parameter constraints and explaining when to use custom disposable types vs. the default.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0348986 and dc67845.

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

@victimsnino victimsnino merged commit 90f9f2f into v2 Nov 14, 2024
37 checks passed
@victimsnino victimsnino deleted the update_docs branch November 14, 2024 18:53
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