Add server-based logic for rppgrpc#612
Conversation
WalkthroughWalkthroughThis update enhances the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Server
participant ClientReactor
participant ServerReactor
Client->>ClientReactor: Initiates bidirectional stream
ClientReactor->>ServerReactor: Sends request
ServerReactor->>Server: Process request
Server->>ServerReactor: Returns response
ServerReactor->>ClientReactor: Sends response
ClientReactor->>Client: Delivers response
Client->>ServerReactor: Closes stream
ServerReactor->>Server: Finalizes connection
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- src/extensions/rppgrpc/rppgrpc/client_reactor.hpp (8 hunks)
- src/extensions/rppgrpc/rppgrpc/rppgrpc.hpp (1 hunks)
- src/extensions/rppgrpc/rppgrpc/server_reactor.hpp (1 hunks)
- src/tests/rppgrpc/test_async_server.cpp (1 hunks)
Additional comments not posted (20)
src/extensions/rppgrpc/rppgrpc/rppgrpc.hpp (1)
15-15: Verify the impact of includingserver_reactor.hpp.Uncommenting this inclusion makes the definitions and declarations in
server_reactor.hppaccessible in this file. Ensure that this change does not introduce any conflicts or unexpected behaviors in the dependent modules.Verification successful
Verification successful for the inclusion of
server_reactor.hpp.The inclusion of
server_reactor.hppinrppgrpc.hppdoes not introduce any conflicts or unexpected behaviors in the codebase. The only usages ofserver_reactorcomponents are inserver.cpp, and there are no additional files that includerppgrpc.hpp.
- No conflicts or dependencies related to
server_reactor.hppwere found.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of including `server_reactor.hpp`. # Test: Check for any compilation errors or warnings introduced by this change. # Expect: No errors or warnings should be present. # Compile the project and capture any errors or warnings. # Note: This script assumes a Makefile or similar build system is present. make 2>&1 | tee compile_output.txt # Search for errors or warnings in the compile output. grep -E "error|warning" compile_output.txtLength of output: 199
Script:
#!/bin/bash # Description: Verify the impact of including `server_reactor.hpp`. # Search for the inclusion of `server_reactor.hpp` in the codebase. rg '#include <rppgrpc/server_reactor.hpp>' # Search for any usage of components from `server_reactor.hpp` in the codebase. rg 'server_reactor' # Check for any potential conflicts or dependencies related to `server_reactor.hpp`. rg 'conflict|dependency' --glob '*.hpp' --glob '*.cpp'Length of output: 681
Script:
#!/bin/bash # Description: Verify the impact of including `server_reactor.hpp`. # Search for files that include `rppgrpc.hpp`. rg '#include <rppgrpc/rppgrpc/rppgrpc.hpp>' # Search for any further usage of `server_reactor` components in the codebase. rg 'server_reactor'Length of output: 544
src/extensions/rppgrpc/rppgrpc/server_reactor.hpp (5)
25-31: LGTM! Theserver_write_datastructure improves thread safety and data management.The encapsulation of the mutex and response queue enhances the organization and maintainability of the code.
33-66: LGTM! Theserver_write_observer_strategystructure effectively manages observer behavior and synchronization.The use of the mutex and the methods for handling messages, errors, and completion are well-implemented.
79-82: LGTM! The constructor and subscription logic are clean and well-implemented.The initialization of the reactor and the subscription to the observer strategy are correctly set up.
96-139: LGTM! TheOnReadDone,OnWriteDone,OnDone, andOnCancelmethods are well-implemented.The methods correctly handle the respective operations and utilize the observer strategy effectively.
150-155: LGTM! Theserver_write_dataandm_observermember variables are correctly initialized and used.The member variables are well-integrated into the class and enhance the management of write operations and message observation.
src/tests/rppgrpc/test_async_server.cpp (7)
31-44: LGTM! TheAsync servertest case setup is correct.The gRPC server and mock service are properly initialized and registered.
47-72: LGTM! Thewriter immediate finishscenario is correctly tested.The test case ensures that the writer completes immediately and the server handles the completion correctly.
74-79: LGTM! Thewriter cancelsscenario is correctly tested.The test case ensures that the writer cancels the operation and the server handles the cancellation correctly.
81-86: LGTM! Theserver cancelsscenario is correctly tested.The test case ensures that the server cancels the operation and the writer handles the cancellation correctly.
88-112: LGTM! Thewriter writesscenario is correctly tested.The test case ensures that the writer sends multiple messages and the server handles the messages correctly.
114-138: LGTM! Thewriter readsscenario is correctly tested.The test case ensures that the writer reads multiple messages and the server handles the messages correctly.
141-143: LGTM! TheAsync serverteardown is correct.The gRPC server is properly shut down and resources are released.
src/extensions/rppgrpc/rppgrpc/client_reactor.hpp (7)
25-31: Encapsulation of write-related state is well-implemented.The
client_write_datastruct encapsulates write-related state, improving code organization and thread safety.
33-66: Centralization of write operation logic is well-implemented.The
client_write_observer_strategystruct centralizes the logic for managing write operations, improving maintainability and synchronization.
86-90: Subscription toclient_write_observer_strategyimproves code organization.The update to subscribe to
client_write_observer_strategyin theclient_bidi_reactorconstructor centralizes write operation handling, improving code organization.
127-134: Update to usem_write_dataimproves consistency and thread safety.The update to use
m_write_datafor managing write state in theOnWriteDonemethod improves code consistency and thread safety.
179-183: Subscription toclient_write_observer_strategyimproves code organization.The update to subscribe to
client_write_observer_strategyin theclient_write_reactorconstructor centralizes write operation handling, improving code organization.
209-216: Update to usem_write_dataimproves consistency and thread safety.The update to use
m_write_datafor managing write state in theOnWriteDonemethod improves code consistency and thread safety.
161-161: Encapsulation of write-related state is well-implemented.The addition of
m_write_datato bothclient_bidi_reactorandclient_write_reactorencapsulates write-related state, improving code organization and thread safety.Also applies to: 241-241
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- src/extensions/rppgrpc/rppgrpc/client_reactor.hpp (7 hunks)
- src/extensions/rppgrpc/rppgrpc/details/base.hpp (1 hunks)
- src/tests/rppgrpc/test_async_server.cpp (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- src/extensions/rppgrpc/rppgrpc/client_reactor.hpp
- src/tests/rppgrpc/test_async_server.cpp
Additional comments not posted (12)
src/extensions/rppgrpc/rppgrpc/details/base.hpp (12)
28-31: LGTM! Constructor initializes observable subscription correctly.The constructor subscribes to an observable from
m_subjectusing theobserver_strategy. This ensures that the class is ready to handle incoming data.
33-33: LGTM! Destructor is correctly implemented.The destructor is defaulted and marked noexcept, which is appropriate for this class.
35-37: LGTM! Method correctly provides access to the observer.The
get_observermethod returns an observer fromm_subject, which is necessary for the class's functionality.
41-41: LGTM! Pure virtual function ensures derived class implementation.The
start_writemethod is correctly declared as a pure virtual function, ensuring derived classes implement the required functionality.
42-42: LGTM! Pure virtual function ensures derived class implementation.The
finish_writesmethod is correctly declared as a pure virtual function, ensuring derived classes implement the required functionality.
44-47: LGTM! Method correctly handles completion of the observable sequence.The
handle_on_donemethod disposes of the subject's disposable, ensuring proper cleanup.
49-62: LGTM! Method correctly manages the write queue and handles completion of writes.The
handle_write_donemethod uses a lock guard to manage the write queue and callsstart_writeorfinish_writesas needed, ensuring thread safety and proper handling of writes.
68-75: LGTM! Method correctly handles incoming messages and manages the write queue.The
on_nextmethod uses a lock guard to manage the write queue and callsstart_writeif the queue was previously empty, ensuring thread safety and proper handling of incoming messages.
77-84: LGTM! Method correctly handles errors and manages the write queue.The
on_errormethod uses a lock guard to set the finished flag and callsfinish_writesif the write queue is empty, ensuring thread safety and proper handling of errors.
85-92: LGTM! Method correctly handles completion of the observable sequence and manages the write queue.The
on_completedmethod uses a lock guard to set the finished flag and callsfinish_writesif the write queue is empty, ensuring thread safety and proper handling of the completion of the observable sequence.
94-94: LGTM! Method correctly indicates that the observer is not disposed.The
is_disposedmethod returns false, which is appropriate for this observer strategy.
95-95: LGTM! Method correctly implemented as a no-op.The
set_upstreammethod is a no-op, which is appropriate for this observer strategy.
There was a problem hiding this comment.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/extensions/rppgrpc/rppgrpc/client_reactor.hpp (5 hunks)
- src/extensions/rppgrpc/rppgrpc/details/base.hpp (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/extensions/rppgrpc/rppgrpc/client_reactor.hpp
Additional comments not posted (7)
src/extensions/rppgrpc/rppgrpc/details/base.hpp (7)
28-31: Ensure exception safety in the constructor.The constructor subscribes to the observable. Ensure that any exceptions thrown during subscription are handled appropriately to prevent resource leaks.
44-47: Handle potential exceptions inhandle_on_done.Ensure that any exceptions thrown during
disposeare handled to maintain stability.
49-62: Ensure thread safety and exception handling inhandle_write_done.The method uses a lock guard for thread safety, but ensure that any exceptions thrown during
start_writeorfinish_writesare handled appropriately.
64-96: Review theobserver_strategystruct for thread safety and exception handling.The struct handles on_next, on_error, and on_completed events. Ensure that all operations within these methods are thread-safe and exceptions are properly managed.
110-111: Ensure exception safety in the constructor and destructor.The default constructor and destructor should ensure that resources are properly managed and exceptions are handled.
121-126: Ensure thread safety and exception handling inhandle_read_done.The method calls
on_nextandstart_read. Ensure that these operations are thread-safe and exceptions are properly managed.
128-134: Handle potential exceptions inhandle_on_done.Ensure that any exceptions thrown during
on_errororon_completedare handled to maintain stability.
There was a problem hiding this comment.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- src/extensions/rppgrpc/rppgrpc/client_reactor.hpp (5 hunks)
- src/extensions/rppgrpc/rppgrpc/details/base.hpp (1 hunks)
- src/extensions/rppgrpc/rppgrpc/server_reactor.hpp (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/extensions/rppgrpc/rppgrpc/client_reactor.hpp
Additional comments not posted (17)
src/extensions/rppgrpc/rppgrpc/server_reactor.hpp (11)
22-25: Template and inheritance structure update.The class template parameters and inheritance structure have been updated to directly use
RequestandResponsetypes. This change simplifies the template and enhances clarity.
40-43: Overridestart_writemethod.The
start_writemethod is overridden to start writing the response. Ensure that this method is correctly utilized and does not introduce any issues.
45-48: Overridestart_readmethod.The
start_readmethod is overridden to start reading the request. Ensure that this method is correctly utilized and does not introduce any issues.
50-53: Overridefinish_writesmethod.The
finish_writesmethod is overridden to finish writing with the given status. Ensure that this method is correctly utilized and does not introduce any issues.
54-60: UpdateOnReadDonemethod.The
OnReadDonemethod is updated to handle the read completion using the base reader class method. Ensure that this update is correct and does not introduce any issues.
62-68: UpdateOnWriteDonemethod.The
OnWriteDonemethod is updated to handle the write completion using the base writer class method. Ensure that this update is correct and does not introduce any issues.
73-76: UpdateOnDonemethod.The
OnDonemethod is updated to handle the completion using the base writer and reader class methods. Ensure that this update is correct and does not introduce any issues.
81-84: UpdateOnCancelmethod.The
OnCancelmethod is updated to handle the cancellation using the base writer and reader class methods. Ensure that this update is correct and does not introduce any issues.
16-16: Ensure correct inclusion of headers.The new header
rppgrpc/details/base.hppis included. Ensure that this header is necessary and correctly referenced.Verification successful
The inclusion of
rppgrpc/details/base.hppis correct and necessary.The
base_writerandbase_readerclasses defined in this header are used inserver_reactor.hpp.
src/extensions/rppgrpc/rppgrpc/server_reactor.hppScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the necessity and correct reference of the new header. # Test: Check for references to `base_writer` and `base_reader` in the codebase. Expect: References to these classes. rg --type cpp 'base_writer|base_reader'Length of output: 4721
30-33: Constructor update.The constructor now initializes the base class and starts sending initial metadata without the previous observer subscription logic. Ensure that the new initialization logic is correct and does not introduce any issues.
Verification successful
Constructor update verified.
The new initialization logic in the
server_bidi_reactorconstructor is correctly tested intest_async_server.cpp. The test ensures that the observable subscription and bidirectional call functionalities are intact, indicating that the new logic does not introduce any issues.
src/tests/rppgrpc/test_async_server.cpp:
- Validates the initialization and usage of
server_bidi_reactor.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new initialization logic in the constructor. # Test: Check for references to `server_bidi_reactor` initialization. Expect: Correct usage of the new constructor. rg --type cpp 'server_bidi_reactor'Length of output: 386
Script:
#!/bin/bash # Description: Check the context around the constructor reference in test_async_server.cpp to understand how the new initialization logic is being tested. # Retrieve 10 lines before and after the reference to the constructor in the test file. rg --type cpp 'server_bidi_reactor' -A 10 -B 10 src/tests/rppgrpc/test_async_server.cppLength of output: 1025
36-37: Expose base class methods.The methods
get_observerandget_observablefrom the base classes are now exposed. Ensure that these methods are correctly utilized in the codebase.Verification successful
The methods
get_observerandget_observableare correctly utilized in the codebase. The implementations and their usage align with their intended functionality in reactive programming.
src/extensions/rppgrpc/rppgrpc/server_reactor.hppsrc/extensions/rppgrpc/rppgrpc/client_reactor.hppsrc/rpp/rpp/subjects/replay_subject.hppsrc/rpp/rpp/subjects/publish_subject.hppsrc/rpp/rpp/subjects/behavior_subject.hppsrc/rpp/rpp/observers/mock_observer.hppsrc/rpp/rpp/operators/details/forwarding_subject.hppScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correct utilization of the exposed methods `get_observer` and `get_observable`. # Test: Check for references to `get_observer` and `get_observable` methods. Expect: Correct usage of these methods. rg --type cpp 'get_observer|get_observable'Length of output: 41162
Script:
#!/bin/bash # Description: Verify the correct utilization of the exposed methods `get_observer` and `get_observable`. # Find the implementation of `get_observer` and `get_observable` in the relevant files. ast-grep --lang cpp --pattern 'auto get_observer() const { $$$ }' ast-grep --lang cpp --pattern 'auto get_observable() const { $$$ }'Length of output: 137
Script:
#!/bin/bash # Description: Verify the correct utilization of the exposed methods `get_observer` and `get_observable`. # Find the implementation of `get_observer` and `get_observable` in the relevant files. rg --type cpp 'auto get_observer' -A 5 rg --type cpp 'auto get_observable' -A 5Length of output: 6848
src/extensions/rppgrpc/rppgrpc/details/base.hpp (6)
30-33: Initialize observer subscription.The constructor initializes the observer subscription. Ensure that this initialization is correct and does not introduce any issues.
46-49: Dispose of the observer.The
handle_on_donemethod disposes of the observer. Ensure that this disposal is correct and does not introduce any issues.
51-64: Handle write completion.The
handle_write_donemethod manages the deque for write operations and handles write completion. Ensure that this method is correctly implemented and does not introduce any issues.
66-98: Observer strategy for write operations.The
observer_strategystruct manages the write operations using the observer pattern. Ensure that this strategy is correctly implemented and does not introduce any issues.
123-128: Handle read completion.The
handle_read_donemethod manages the read operations and handles read completion. Ensure that this method is correctly implemented and does not introduce any issues.
130-136: Handle completion.The
handle_on_donemethod manages the completion of read operations. Ensure that this method is correctly implemented and does not introduce any issues.
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/tests/CMakeLists.txt (2 hunks)
Additional comments not posted (2)
src/tests/CMakeLists.txt (2)
28-28: LGTM! Simplifies linking process.The change to link the test target to
rppgrpc_tests_protoimproves clarity and maintainability by eliminating the need for a dynamically named proto target.
59-59: LGTM! Conditional proto target creation.The change to create the
rppgrpc_tests_prototarget within theRPP_BUILD_GRPC_CODEconditional block ensures that the proto target is only created when necessary, improving build efficiency.
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/rpp/rpp/operators/publish.hpp (1 hunks)
- src/tests/rppgrpc/test_async_server.cpp (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/tests/rppgrpc/test_async_server.cpp
Additional comments not posted (1)
src/rpp/rpp/operators/publish.hpp (1)
4-4: LGTM! Verify the presence ofpublish_subject.hpp.The inclusion of
publish_subject.hppappears to be correct and necessary for the functionality of thepublishfunction.Ensure that the
publish_subject.hppfile exists and is correctly implemented.Verification successful
Verified!
The inclusion of
publish_subject.hppinpublish.hppis correct and necessary for the functionality of thepublishfunction. Thepublish_subject.hppfile is present and correctly implemented.
- The file
src/rpp/rpp/subjects/publish_subject.hppcontains the necessary implementations forpublish_subjectandserialized_publish_subject.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the presence of `publish_subject.hpp`. # Test: Search for the `publish_subject.hpp` file. Expect: File should be present. fd publish_subject.hppLength of output: 65
Script:
#!/bin/bash # Description: Inspect the contents of `publish_subject.hpp` to ensure it is correctly implemented. # Display the contents of the `publish_subject.hpp` file. cat src/rpp/rpp/subjects/publish_subject.hppLength of output: 4072
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/extensions/rppgrpc/rppgrpc/server_reactor.hpp (1 hunks)
- src/tests/rppgrpc/test_async_server.cpp (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/tests/rppgrpc/test_async_server.cpp
Additional comments not posted (20)
src/extensions/rppgrpc/rppgrpc/server_reactor.hpp (20)
30-33: Constructor initialization is correct.The constructor initializes the base class and starts sending initial metadata. It also handles the initial read done event correctly.
40-43: Methodstart_writeis correctly implemented.The method correctly starts a write operation using the base class.
45-48: Methodstart_readis correctly implemented.The method correctly starts a read operation using the base class.
50-53: Methodfinish_writesis correctly implemented.The method correctly finishes the write operation using the base class.
54-60: MethodOnReadDonehandles read completion correctly.The method checks if the read operation was successful and handles the read done event using the base reader class.
62-69: MethodOnWriteDonehandles write completion correctly.The method checks if the write operation was successful and handles the write done event using the base writer class.
71-77: MethodOnDonehandles the completion of the reactor correctly.The method handles the on done event using the base writer and reader classes and deletes the reactor instance.
79-85: MethodOnCancelhandles the cancellation of the reactor correctly.The method handles the on cancel event using the base writer and reader classes and finishes the reactor with a cancelled status.
96-99: Constructor initialization is correct.The constructor initializes the base class and starts sending initial metadata.
105-108: Methodstart_writeis correctly implemented.The method correctly starts a write operation using the base class.
110-110: Methodstart_readis a no-op as expected.The method does nothing, which is expected for a write reactor.
112-115: Methodfinish_writesis correctly implemented.The method correctly finishes the write operation using the base class.
117-125: MethodOnWriteDonehandles write completion correctly.The method checks if the write operation was successful and handles the write done event using the base writer class.
127-133: MethodOnDonehandles the completion of the reactor correctly.The method handles the on done event using the base writer and reader classes and deletes the reactor instance.
135-140: MethodOnCancelhandles the cancellation of the reactor correctly.The method handles the on cancel event using the base writer and reader classes and finishes the reactor with a cancelled status.
152-155: Constructor initialization is correct.The constructor initializes the base class, starts sending initial metadata, and handles the initial read done event correctly.
161-164: Methodstart_readis correctly implemented.The method correctly starts a read operation using the base class.
166-175: MethodOnReadDonehandles read completion correctly.The method checks if the read operation was successful and handles the read done event using the base reader class.
177-182: MethodOnDonehandles the completion of the reactor correctly.The method handles the on done event using the base reader class and deletes the reactor instance.
184-187: MethodOnCancelhandles the cancellation of the reactor correctly.The method handles the on cancel event using the base reader class.
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/tests/rppgrpc/test_async_server.cpp (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/tests/rppgrpc/test_async_server.cpp
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/tests/rppgrpc/test_async_server.cpp (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/tests/rppgrpc/test_async_server.cpp
BENCHMARK RESULTS (AUTOGENERATED)
|
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| Subscribe empty callbacks to empty observable | 303.25 ns | 2.16 ns | 2.16 ns | 1.00 |
| Subscribe empty callbacks to empty observable via pipe operator | 305.85 ns | 2.16 ns | 2.16 ns | 1.00 |
Sources
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| from array of 1 - create + subscribe + immediate | 697.11 ns | 0.31 ns | 0.31 ns | 1.00 |
| from array of 1 - create + subscribe + current_thread | 1030.41 ns | 3.42 ns | 3.42 ns | 1.00 |
| concat_as_source of just(1 immediate) create + subscribe | 2257.82 ns | 113.74 ns | 125.92 ns | 0.90 |
| defer from array of 1 - defer + create + subscribe + immediate | 735.11 ns | 0.31 ns | 0.31 ns | 1.00 |
| interval - interval + take(3) + subscribe + immediate | 2172.68 ns | 59.19 ns | 59.19 ns | 1.00 |
| interval - interval + take(3) + subscribe + current_thread | 3030.62 ns | 32.42 ns | 32.40 ns | 1.00 |
| from array of 1 - create + as_blocking + subscribe + new_thread | 27237.36 ns | 26905.10 ns | 28119.03 ns | 0.96 |
| from array of 1000 - create + as_blocking + subscribe + new_thread | 40422.48 ns | 50907.80 ns | 52336.14 ns | 0.97 |
| concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe | 3570.07 ns | 139.77 ns | 143.34 ns | 0.98 |
Filtering Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+take(1)+subscribe | 1084.59 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just+filter(true)+subscribe | 833.56 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just(1,2)+skip(1)+subscribe | 1050.99 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just(1,1,2)+distinct_until_changed()+subscribe | 917.50 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just(1,2)+first()+subscribe | 1238.16 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just(1,2)+last()+subscribe | 928.20 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just+take_last(1)+subscribe | 1121.02 ns | 17.90 ns | 17.90 ns | 1.00 |
| immediate_just(1,2,3)+element_at(1)+subscribe | 854.62 ns | 0.31 ns | 0.31 ns | 1.00 |
Schedulers
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate scheduler create worker + schedule | 273.59 ns | 2.16 ns | 2.16 ns | 1.00 |
| current_thread scheduler create worker + schedule | 373.87 ns | 5.56 ns | 5.56 ns | 1.00 |
| current_thread scheduler create worker + schedule + recursive schedule | 846.43 ns | 56.40 ns | 56.46 ns | 1.00 |
Transforming Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+map(v*2)+subscribe | 854.07 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just+scan(10, std::plus)+subscribe | 930.68 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just+flat_map(immediate_just(v*2))+subscribe | 2436.56 ns | 177.66 ns | 151.76 ns | 1.17 |
| immediate_just+buffer(2)+subscribe | 1535.71 ns | 13.59 ns | 24.35 ns | 0.56 |
| immediate_just+window(2)+subscribe + subscsribe inner | 2456.58 ns | 1086.03 ns | 1065.26 ns | 1.02 |
Conditional Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+take_while(false)+subscribe | 832.02 ns | - | - | 0.00 |
| immediate_just+take_while(true)+subscribe | 912.29 ns | 0.31 ns | 0.31 ns | 1.00 |
Utility Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just(1)+subscribe_on(immediate)+subscribe | 1977.74 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 | 3429.62 ns | 189.56 ns | 174.92 ns | 1.08 |
| immediate_just(1) + merge_with(immediate_just(2)) + subscribe | 3622.70 ns | 179.17 ns | 171.34 ns | 1.05 |
| immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe | - | 145.14 ns | 124.22 ns | 1.17 |
| immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe | 3599.99 ns | 946.39 ns | 909.13 ns | 1.04 |
| immediate_just(1) + zip(immediate_just(2)) + subscribe | 2122.66 ns | 214.15 ns | 212.07 ns | 1.01 |
Subjects
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| publish_subject with 1 observer - on_next | 34.57 ns | 14.73 ns | 14.72 ns | 1.00 |
| subscribe 100 observers to publish_subject | 199929.00 ns | 15258.01 ns | 14914.44 ns | 1.02 |
| 100 on_next to 100 observers to publish_subject | 32627.34 ns | 17114.41 ns | 18816.75 ns | 0.91 |
Scenarios
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| basic sample | 1451.84 ns | 12.66 ns | 12.66 ns | 1.00 |
| basic sample with immediate scheduler | 1394.79 ns | 5.55 ns | 5.55 ns | 1.00 |
Aggregating Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+reduce(10, std::plus)+subscribe | 919.05 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 | 2090.52 ns | 969.20 ns | 975.50 ns | 0.99 |
ci-macos
General
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| Subscribe empty callbacks to empty observable | 984.55 ns | 3.93 ns | 3.90 ns | 1.01 |
| Subscribe empty callbacks to empty observable via pipe operator | 981.95 ns | 3.95 ns | 3.90 ns | 1.01 |
Sources
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| from array of 1 - create + subscribe + immediate | 1921.08 ns | 0.23 ns | 0.23 ns | 1.00 |
| from array of 1 - create + subscribe + current_thread | 2441.40 ns | 34.49 ns | 34.45 ns | 1.00 |
| concat_as_source of just(1 immediate) create + subscribe | 5395.24 ns | 330.55 ns | 333.32 ns | 0.99 |
| defer from array of 1 - defer + create + subscribe + immediate | 1971.42 ns | 0.23 ns | 0.23 ns | 1.00 |
| interval - interval + take(3) + subscribe + immediate | 4921.37 ns | 113.78 ns | 114.83 ns | 0.99 |
| interval - interval + take(3) + subscribe + current_thread | 6036.20 ns | 96.00 ns | 94.64 ns | 1.01 |
| from array of 1 - create + as_blocking + subscribe + new_thread | 90247.20 ns | 79537.00 ns | 79948.33 ns | 0.99 |
| from array of 1000 - create + as_blocking + subscribe + new_thread | 96641.10 ns | 88251.92 ns | 84225.07 ns | 1.05 |
| concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe | 7935.51 ns | 392.71 ns | 378.42 ns | 1.04 |
Filtering Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+take(1)+subscribe | 2871.41 ns | 0.23 ns | 0.23 ns | 1.00 |
| immediate_just+filter(true)+subscribe | 2102.19 ns | 0.23 ns | 0.23 ns | 1.00 |
| immediate_just(1,2)+skip(1)+subscribe | 2742.58 ns | 0.23 ns | 0.23 ns | 1.00 |
| immediate_just(1,1,2)+distinct_until_changed()+subscribe | 2069.28 ns | 0.47 ns | 0.47 ns | 1.00 |
| immediate_just(1,2)+first()+subscribe | 3184.45 ns | 0.23 ns | 0.23 ns | 1.00 |
| immediate_just(1,2)+last()+subscribe | 2382.16 ns | 0.23 ns | 0.23 ns | 1.00 |
| immediate_just+take_last(1)+subscribe | 3020.56 ns | 70.87 ns | 70.22 ns | 1.01 |
| immediate_just(1,2,3)+element_at(1)+subscribe | 2115.96 ns | 0.23 ns | 0.23 ns | 1.00 |
Schedulers
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate scheduler create worker + schedule | 857.36 ns | 4.14 ns | 4.16 ns | 1.00 |
| current_thread scheduler create worker + schedule | 1187.22 ns | 39.92 ns | 39.85 ns | 1.00 |
| current_thread scheduler create worker + schedule + recursive schedule | 1993.41 ns | 208.59 ns | 203.80 ns | 1.02 |
Transforming Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+map(v*2)+subscribe | 2128.36 ns | 4.20 ns | 4.20 ns | 1.00 |
| immediate_just+scan(10, std::plus)+subscribe | 2386.02 ns | 0.48 ns | 0.47 ns | 1.02 |
| immediate_just+flat_map(immediate_just(v*2))+subscribe | 5403.57 ns | 418.67 ns | 401.56 ns | 1.04 |
| immediate_just+buffer(2)+subscribe | 2491.44 ns | 70.35 ns | 69.84 ns | 1.01 |
| immediate_just+window(2)+subscribe + subscsribe inner | 5289.83 ns | 2398.45 ns | 2372.94 ns | 1.01 |
Conditional Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+take_while(false)+subscribe | 2098.69 ns | - | - | 0.00 |
| immediate_just+take_while(true)+subscribe | 2110.55 ns | 0.23 ns | 0.23 ns | 1.00 |
Utility Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just(1)+subscribe_on(immediate)+subscribe | 4863.65 ns | 4.90 ns | 5.13 ns | 0.95 |
Combining Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe | 7456.34 ns | 440.05 ns | 440.31 ns | 1.00 |
| immediate_just(1) + merge_with(immediate_just(2)) + subscribe | 8421.06 ns | 475.67 ns | 440.38 ns | 1.08 |
| immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe | - | 460.39 ns | 458.54 ns | 1.00 |
| immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe | 7979.12 ns | 1910.87 ns | 1907.85 ns | 1.00 |
| immediate_just(1) + zip(immediate_just(2)) + subscribe | 5145.81 ns | 840.48 ns | 839.44 ns | 1.00 |
Subjects
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| publish_subject with 1 observer - on_next | 73.92 ns | 50.07 ns | 49.28 ns | 1.02 |
| subscribe 100 observers to publish_subject | 346700.00 ns | 40742.84 ns | 40719.71 ns | 1.00 |
| 100 on_next to 100 observers to publish_subject | 48780.65 ns | 17063.46 ns | 17216.52 ns | 0.99 |
Scenarios
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| basic sample | 2765.50 ns | 64.87 ns | 65.05 ns | 1.00 |
| basic sample with immediate scheduler | 2759.23 ns | 21.97 ns | 19.29 ns | 1.14 |
Aggregating Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+reduce(10, std::plus)+subscribe | 2386.96 ns | 0.23 ns | 0.23 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 | 6802.32 ns | 4119.52 ns | 4075.34 ns | 1.01 |
ci-ubuntu-clang
General
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| Subscribe empty callbacks to empty observable | 278.45 ns | 1.59 ns | 1.58 ns | 1.01 |
| Subscribe empty callbacks to empty observable via pipe operator | 270.22 ns | 1.59 ns | 1.56 ns | 1.02 |
Sources
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| from array of 1 - create + subscribe + immediate | 560.26 ns | 0.31 ns | 0.31 ns | 1.00 |
| from array of 1 - create + subscribe + current_thread | 784.30 ns | 4.01 ns | 4.01 ns | 1.00 |
| concat_as_source of just(1 immediate) create + subscribe | 2354.91 ns | 134.75 ns | 134.67 ns | 1.00 |
| defer from array of 1 - defer + create + subscribe + immediate | 775.76 ns | 0.31 ns | 0.31 ns | 1.00 |
| interval - interval + take(3) + subscribe + immediate | 2202.41 ns | 58.27 ns | 58.27 ns | 1.00 |
| interval - interval + take(3) + subscribe + current_thread | 3213.23 ns | 30.86 ns | 30.88 ns | 1.00 |
| from array of 1 - create + as_blocking + subscribe + new_thread | 30304.86 ns | 28067.39 ns | 28828.75 ns | 0.97 |
| from array of 1000 - create + as_blocking + subscribe + new_thread | 36838.43 ns | 36504.00 ns | 38425.07 ns | 0.95 |
| concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe | 3682.67 ns | 157.35 ns | 157.38 ns | 1.00 |
Filtering Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+take(1)+subscribe | 1139.20 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just+filter(true)+subscribe | 845.91 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just(1,2)+skip(1)+subscribe | 1083.51 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just(1,1,2)+distinct_until_changed()+subscribe | 862.42 ns | 0.62 ns | 0.62 ns | 1.00 |
| immediate_just(1,2)+first()+subscribe | 1377.33 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just(1,2)+last()+subscribe | 1008.53 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just+take_last(1)+subscribe | 1185.61 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just(1,2,3)+element_at(1)+subscribe | 858.56 ns | 0.31 ns | 0.31 ns | 1.00 |
Schedulers
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate scheduler create worker + schedule | 276.72 ns | 1.54 ns | 1.56 ns | 0.99 |
| current_thread scheduler create worker + schedule | 385.32 ns | 4.49 ns | 4.02 ns | 1.12 |
| current_thread scheduler create worker + schedule + recursive schedule | 841.82 ns | 55.85 ns | 55.59 ns | 1.00 |
Transforming Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+map(v*2)+subscribe | 854.56 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just+scan(10, std::plus)+subscribe | 993.44 ns | 0.31 ns | 0.31 ns | 1.00 |
| immediate_just+flat_map(immediate_just(v*2))+subscribe | 2243.42 ns | 136.33 ns | 136.38 ns | 1.00 |
| immediate_just+buffer(2)+subscribe | 1504.22 ns | 13.98 ns | 13.58 ns | 1.03 |
| immediate_just+window(2)+subscribe + subscsribe inner | 2418.30 ns | 915.82 ns | 933.05 ns | 0.98 |
Conditional Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+take_while(false)+subscribe | 829.61 ns | - | - | 0.00 |
| immediate_just+take_while(true)+subscribe | 840.58 ns | 0.31 ns | 0.31 ns | 1.00 |
Utility Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just(1)+subscribe_on(immediate)+subscribe | 1983.25 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 | 3253.32 ns | 157.64 ns | 158.43 ns | 1.00 |
| immediate_just(1) + merge_with(immediate_just(2)) + subscribe | 3684.50 ns | 150.76 ns | 145.78 ns | 1.03 |
| immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe | - | 144.24 ns | 142.33 ns | 1.01 |
| immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe | 3405.12 ns | 841.59 ns | 842.95 ns | 1.00 |
| immediate_just(1) + zip(immediate_just(2)) + subscribe | 2173.60 ns | 201.70 ns | 198.37 ns | 1.02 |
Subjects
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| publish_subject with 1 observer - on_next | 54.74 ns | 20.56 ns | 17.69 ns | 1.16 |
| subscribe 100 observers to publish_subject | 209769.40 ns | 16057.73 ns | 16022.19 ns | 1.00 |
| 100 on_next to 100 observers to publish_subject | 35675.27 ns | 17907.27 ns | 20623.71 ns | 0.87 |
Scenarios
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| basic sample | 1324.47 ns | 11.11 ns | 11.11 ns | 1.00 |
| basic sample with immediate scheduler | 1281.19 ns | 5.86 ns | 5.86 ns | 1.00 |
Aggregating Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+reduce(10, std::plus)+subscribe | 990.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 | 2152.41 ns | 1231.02 ns | 1224.81 ns | 1.01 |
ci-windows
General
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| Subscribe empty callbacks to empty observable | 562.79 ns | 4.94 ns | 4.05 ns | 1.22 |
| Subscribe empty callbacks to empty observable via pipe operator | 578.25 ns | 4.94 ns | 4.01 ns | 1.23 |
Sources
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| from array of 1 - create + subscribe + immediate | 1155.68 ns | 5.55 ns | 5.63 ns | 0.99 |
| from array of 1 - create + subscribe + current_thread | 1425.11 ns | 15.75 ns | 15.74 ns | 1.00 |
| concat_as_source of just(1 immediate) create + subscribe | 3733.45 ns | 172.47 ns | 174.77 ns | 0.99 |
| defer from array of 1 - defer + create + subscribe + immediate | 1196.58 ns | 5.24 ns | 5.24 ns | 1.00 |
| interval - interval + take(3) + subscribe + immediate | 3234.70 ns | 133.32 ns | 133.46 ns | 1.00 |
| interval - interval + take(3) + subscribe + current_thread | 3414.33 ns | 52.11 ns | 52.75 ns | 0.99 |
| from array of 1 - create + as_blocking + subscribe + new_thread | 117910.00 ns | 111300.00 ns | 115255.56 ns | 0.97 |
| from array of 1000 - create + as_blocking + subscribe + new_thread | 134537.50 ns | 134377.78 ns | 132122.22 ns | 1.02 |
| concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe | 5326.37 ns | 209.14 ns | 210.39 ns | 0.99 |
Filtering Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+take(1)+subscribe | 1804.38 ns | 12.87 ns | 12.88 ns | 1.00 |
| immediate_just+filter(true)+subscribe | 1311.79 ns | 12.38 ns | 11.68 ns | 1.06 |
| immediate_just(1,2)+skip(1)+subscribe | 1702.92 ns | 13.37 ns | 13.38 ns | 1.00 |
| immediate_just(1,1,2)+distinct_until_changed()+subscribe | 1616.51 ns | 15.95 ns | 15.82 ns | 1.01 |
| immediate_just(1,2)+first()+subscribe | 2035.56 ns | 12.95 ns | 12.64 ns | 1.02 |
| immediate_just(1,2)+last()+subscribe | 1773.61 ns | 13.80 ns | 14.08 ns | 0.98 |
| immediate_just+take_last(1)+subscribe | 2000.69 ns | 59.31 ns | 59.81 ns | 0.99 |
| immediate_just(1,2,3)+element_at(1)+subscribe | 1319.45 ns | 13.79 ns | 13.78 ns | 1.00 |
Schedulers
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate scheduler create worker + schedule | 476.29 ns | 6.18 ns | 6.17 ns | 1.00 |
| current_thread scheduler create worker + schedule | 649.15 ns | 13.73 ns | 13.68 ns | 1.00 |
| current_thread scheduler create worker + schedule + recursive schedule | 1356.18 ns | 106.07 ns | 104.92 ns | 1.01 |
Transforming Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+map(v*2)+subscribe | 1315.71 ns | 12.33 ns | 11.33 ns | 1.09 |
| immediate_just+scan(10, std::plus)+subscribe | 1413.71 ns | 21.59 ns | 21.29 ns | 1.01 |
| immediate_just+flat_map(immediate_just(v*2))+subscribe | 3445.45 ns | 202.18 ns | 202.69 ns | 1.00 |
| immediate_just+buffer(2)+subscribe | 2619.69 ns | 59.74 ns | 59.72 ns | 1.00 |
| immediate_just+window(2)+subscribe + subscsribe inner | 3978.29 ns | 1310.17 ns | 1309.73 ns | 1.00 |
Conditional Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+take_while(false)+subscribe | 1620.31 ns | 11.46 ns | 11.46 ns | 1.00 |
| immediate_just+take_while(true)+subscribe | 1309.73 ns | 12.40 ns | 11.74 ns | 1.06 |
Utility Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just(1)+subscribe_on(immediate)+subscribe | 3116.76 ns | 7.71 ns | 7.71 ns | 1.00 |
Combining Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe | 5097.54 ns | 225.24 ns | 226.63 ns | 0.99 |
| immediate_just(1) + merge_with(immediate_just(2)) + subscribe | 5431.38 ns | 209.18 ns | 209.81 ns | 1.00 |
| immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe | - | 198.51 ns | 198.15 ns | 1.00 |
| immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe | 5363.85 ns | 969.01 ns | 949.54 ns | 1.02 |
| immediate_just(1) + zip(immediate_just(2)) + subscribe | 3535.74 ns | 523.08 ns | 518.78 ns | 1.01 |
Subjects
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| publish_subject with 1 observer - on_next | 36.50 ns | 20.36 ns | 20.36 ns | 1.00 |
| subscribe 100 observers to publish_subject | 264075.00 ns | 26902.56 ns | 29132.43 ns | 0.92 |
| 100 on_next to 100 observers to publish_subject | 51595.65 ns | 32708.57 ns | 33103.33 ns | 0.99 |
Scenarios
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| basic sample | 1850.88 ns | 57.04 ns | 56.55 ns | 1.01 |
| basic sample with immediate scheduler | 1860.51 ns | 36.75 ns | 36.75 ns | 1.00 |
Aggregating Operators
| name | rxcpp | rpp | prev rpp | ratio |
|---|---|---|---|---|
| immediate_just+reduce(10, std::plus)+subscribe | 1451.99 ns | 19.99 ns | 20.00 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 | 2158.12 ns | 342.30 ns | 343.06 ns | 1.00 |
There was a problem hiding this comment.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- src/tests/rppgrpc/test_async_client.cpp (1 hunks)
- src/tests/rppgrpc/test_async_server.cpp (1 hunks)
- src/tests/utils/rpp_trompeloil.hpp (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/tests/rppgrpc/test_async_server.cpp
Additional comments not posted (3)
src/tests/utils/rpp_trompeloil.hpp (1)
11-11: Inclusion of<thread>header is appropriate.The inclusion of
<thread>is necessary for usingstd::this_thread::sleep_forin thewaitfunction.src/tests/rppgrpc/test_async_client.cpp (2)
18-26: Encapsulation ofserviceclass within an unnamed namespace is appropriate.This change limits the visibility of the
serviceclass to the current translation unit, avoiding name clashes and improving modularity.
Line range hint
73-79: Verify the new mechanism for handling expectations in tests.The removal of the
waitfunction suggests a shift in the testing strategy. Ensure that the new mechanism for handling expectations is properly integrated and tested.
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/extensions/rppgrpc/rppgrpc/client_reactor.hpp (2 hunks)
- src/extensions/rppgrpc/rppgrpc/server_reactor.hpp (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/extensions/rppgrpc/rppgrpc/client_reactor.hpp
Additional comments not posted (9)
src/extensions/rppgrpc/rppgrpc/server_reactor.hpp (9)
81-87: Verify deletion logic inOnDone.The reactor deletes itself in
OnDone. Ensure that this is safe and that no further operations are attempted on the reactor after deletion.
89-95: Verify deletion logic inOnCancel.The reactor deletes itself in
OnCancel. Ensure that this is safe and that no further operations are attempted on the reactor after deletion.
40-43: Ensure proper initialization and metadata handling.The constructor initializes the base class and starts sending initial metadata. Ensure that this is the desired behavior and that metadata is correctly handled in all scenarios.
Verification successful
Initialization and metadata handling in
server_bidi_reactorare correctly implemented and tested.The constructor of
server_bidi_reactorinitializes the base class and handles metadata as expected. Its usage insrc/tests/rppgrpc/test_async_server.cppindicates that this behavior is tested, ensuring reliability. No issues found.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the initialization and metadata handling in `server_bidi_reactor`. # Test: Search for the constructor usage. Expect: Proper initialization and metadata handling. rg --type cpp -A 5 $'server_bidi_reactor::server_bidi_reactor'Length of output: 61
Script:
#!/bin/bash # Description: Search for the `server_bidi_reactor` class definition and any inline constructor definitions or usages. # Find the definition of the `server_bidi_reactor` class. rg --type cpp -A 10 'class server_bidi_reactor' # Search for any instantiations or inline definitions of `server_bidi_reactor`. rg --type cpp 'server_bidi_reactor<'Length of output: 1184
209-212: Verify handling ofOnCancel.The method handles cancellation by signaling an error. Ensure that this is the intended behavior and that it aligns with the overall logic.
Verification successful
Handling of
OnCancelis intentional and consistent.The
OnCancelmethod inserver_read_reactor.hppconsistently signals an error by invokinghandle_on_donewith an exception. This behavior aligns with the intended design of the class, which is marked asfinal, ensuring no further overrides. The handling of cancellation appears deliberate and consistent across the class.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the handling of cancellation in `OnCancel`. # Test: Search for the `OnCancel` method usage. Expect: Proper handling of cancellation. rg --type cpp -A 5 $'server_read_reactor::OnCancel'Length of output: 50
Script:
#!/bin/bash # Description: Search for the `OnCancel` method definition and usage within the codebase. # Find the definition of the `OnCancel` method in the codebase. rg --type cpp -A 10 'void OnCancel() override' # Search for any class definitions related to `server_read_reactor`. rg --type cpp 'class server_read_reactor' # Search for any derived classes that might override `OnCancel`. rg --type cpp 'OnCancel' -A 5Length of output: 2303
191-196: Ensure proper handling of read completion inOnReadDone.The method finishes with
grpc::Status::OKif the read is not successful. Verify that this is the intended behavior and that it aligns with the overall logic.Verification successful
Proper handling of read completion in
OnReadDoneis confirmed.The
server_read_reactorclass uses gRPC's lifecycle management. TheOnReadDonemethod's logic to finish withgrpc::Status::OKwhenokis false aligns with a graceful handling of read failures. This behavior is consistent with the class's design and integration with gRPC. No further changes are necessary.
src/extensions/rppgrpc/rppgrpc/server_reactor.hpp: Definition and lifecycle management ofserver_read_reactor.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the handling of read completion in `OnReadDone`. # Test: Search for the `OnReadDone` method usage. Expect: Proper handling of read completion. rg --type cpp -A 5 $'server_read_reactor::OnReadDone'Length of output: 52
Script:
#!/bin/bash # Search for the definition and methods of the `server_read_reactor` class to understand its lifecycle and integration. ast-grep --lang cpp --pattern $'class server_read_reactor : public grpc::ServerReadReactor<$_> { $$$ }'Length of output: 106
Script:
#!/bin/bash # Search for the `server_read_reactor` class across the codebase to locate its definition and related comments. rg --type cpp -A 10 'server_read_reactor'Length of output: 2421
202-206: Verify deletion logic inOnDone.The reactor deletes itself in
OnDone. Ensure that this is safe and that no further operations are attempted on the reactor after deletion.
148-151: Verify deletion logic inOnDone.The reactor deletes itself in
OnDone. Ensure that this is safe and that no further operations are attempted on the reactor after deletion.
153-158: Verify deletion logic inOnCancel.The reactor deletes itself in
OnCancel. Ensure that this is safe and that no further operations are attempted on the reactor after deletion.
135-140: Ensure proper handling of write completion inOnWriteDone.The method finishes with
grpc::Status::OKif the write is not successful. Verify that this is the intended behavior and that it aligns with the overall logic.Verification successful
Write Completion Handling in
OnWriteDoneis ConsistentThe
OnWriteDonemethod's behavior of finishing withgrpc::Status::OKwhen a write is unsuccessful aligns with the class's overall strategy for handling operations. This approach is consistent with other methods likeOnReadDoneandOnCancel, ensuring a stable state by gracefully handling errors. No changes are necessary.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the handling of write completion in `OnWriteDone`. # Test: Search for the `OnWriteDone` method usage. Expect: Proper handling of write completion. rg --type cpp -A 5 $'server_write_reactor::OnWriteDone'Length of output: 54
Script:
#!/bin/bash # Search for the definition and methods of the `server_write_reactor` class to gather more context. ast-grep --lang cpp --pattern $'class server_write_reactor : public grpc::ServerWriteReactor<$_> { $$$ }'Length of output: 108
Script:
#!/bin/bash # Broaden the search to locate the `server_write_reactor` class and its methods. rg --type cpp -A 10 'class server_write_reactor'Length of output: 960
Script:
#!/bin/bash # Search for all methods within the `server_write_reactor` class to understand its complete logic. rg --type cpp -A 10 'server_write_reactor::'Length of output: 44
Script:
#!/bin/bash # Directly search for method definitions in the server_reactor.hpp file to understand the server_write_reactor class. rg --type cpp -A 10 'void' src/extensions/rppgrpc/rppgrpc/server_reactor.hppLength of output: 3215
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- src/examples/rppgrpc/doxygen/server_reactor.cpp (1 hunks)
- src/extensions/rppgrpc/rppgrpc/client_reactor.hpp (2 hunks)
- src/extensions/rppgrpc/rppgrpc/fwd.hpp (1 hunks)
- src/extensions/rppgrpc/rppgrpc/server_reactor.hpp (1 hunks)
- src/rpp/rpp/observables/observable.hpp (1 hunks)
- src/rpp/rpp/operators/subscribe.hpp (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/extensions/rppgrpc/rppgrpc/client_reactor.hpp
Additional comments not posted (11)
src/extensions/rppgrpc/rppgrpc/fwd.hpp (3)
31-32: New Class Declaration:server_bidi_reactor.The
server_bidi_reactorclass is introduced with template parametersRequestandResponse. Ensure that these types adhere to therpp::constraint::decayed_typeconstraint for proper type handling.
34-35: New Class Declaration:server_write_reactor.The
server_write_reactorclass is introduced with a template parameterRequest. Ensure that this type adheres to therpp::constraint::decayed_typeconstraint for proper type handling.
37-38: New Class Declaration:server_read_reactor.The
server_read_reactorclass is introduced with a template parameterResponse. Ensure that this type adheres to therpp::constraint::decayed_typeconstraint for proper type handling.src/examples/rppgrpc/doxygen/server_reactor.cpp (3)
15-22: Example Implementation:ClientSideusingserver_read_reactor.The
ClientSidemethod correctly demonstrates the use ofserver_read_reactor. Ensure that the observable's subscription handles all necessary events and errors.
24-34: Example Implementation:Bidirectionalusingserver_bidi_reactor.The
Bidirectionalmethod demonstrates the use ofserver_bidi_reactor. Ensure that both observable and observer are used correctly to manage the bidirectional stream.
36-46: Example Implementation:ServerSideusingserver_write_reactor.The
ServerSidemethod demonstrates the use ofserver_write_reactor. Ensure that the observable's subscription is correctly set up to handle completion and errors.src/extensions/rppgrpc/rppgrpc/server_reactor.hpp (3)
35-99: Implementation Review:server_bidi_reactor.The
server_bidi_reactorclass is well-structured, utilizing base classes for handling read and write operations. Ensure that the error handling inOnReadDone,OnWriteDone,OnDone, andOnCancelis robust and that resources are properly managed withdelete this.
112-167: Implementation Review:server_write_reactor.The
server_write_reactorclass correctly implements the write-only server reactor pattern. Verify that the handling ofOnWriteDoneandOnCancelensures proper completion and error signaling.
179-221: Implementation Review:server_read_reactor.The
server_read_reactorclass implements the read-only server reactor pattern. Ensure that theOnReadDoneandOnCancelmethods handle stream completion and errors appropriately.src/rpp/rpp/operators/subscribe.hpp (1)
327-331: Ensure the correctness of the newsubscribefunction.The new
subscribefunction provides a streamlined way to handle only the completion of an observable. It uses default empty functions forOnNextand a rethrow error handler forOnError, which is appropriate for the intended use case. Ensure that this function is covered by tests to verify its behavior in different scenarios.src/rpp/rpp/observables/observable.hpp (1)
208-212: Verify the functionality of the newsubscribeoverload.The new overload for the
subscribemethod allows handling only the completion event. It uses default empty functions forOnNextand a rethrow error handler forOnError, which aligns with the intended use case. Ensure that this behavior is tested to confirm its functionality.
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/rpp/rpp/operators/subscribe.hpp (2 hunks)
Additional comments not posted (2)
src/rpp/rpp/operators/subscribe.hpp (2)
212-212: Improved type-checking inon_next_likeconcept.The addition of the
!rpp::constraint::on_completed<OnNext>constraint refines the type-checking capabilities, ensuring that only appropriate types are used with the subscription mechanism.
327-331: Newsubscribeoverload enhances usability.The new overload accepting only an
OnCompletedparameter simplifies the subscription process when only completion handling is required.Ensure that this new overload is used correctly in the codebase.
b091fa6 to
c16c66a
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/examples/rppgrpc/doxygen/server_reactor.cpp (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/examples/rppgrpc/doxygen/server_reactor.cpp
|



Summary by CodeRabbit
New Features
Bug Fixes
Tests