Try to add some extra type erasure without performance hit to reduce binary bloat#320
Try to add some extra type erasure without performance hit to reduce binary bloat#320AlexInLog wants to merge 6 commits into
Conversation
Codecov Report
@@ Coverage Diff @@
## main #320 +/- ##
==========================================
+ Coverage 97.88% 97.92% +0.04%
==========================================
Files 114 114
Lines 1794 1830 +36
==========================================
+ Hits 1756 1792 +36
Misses 38 38
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
| requires (!std::is_same_v<std::decay_t<TObserver>, type_erased_observer<T, StateSize, StateAlignment>> && | ||
| sizeof(type_erased_observer_state<T, std::decay_t<TObserver>>) == StateSize && | ||
| alignof(type_erased_observer_state<T, std::decay_t<TObserver>>) == StateAlignment) | ||
| type_erased_observer(TObserver&& obs) |
There was a problem hiding this comment.
constructor accepting a forwarding reference can hide the copy and move constructors
| template<constraint::on_next_fn<T> OnNext = utils::empty_function_t<T>, | ||
| constraint::on_error_fn OnError = utils::rethrow_error_t, | ||
| constraint::on_completed_fn OnCompleted = utils::empty_function_t<>> | ||
| dynamic_observer(OnNext&& on_next = {}, OnError&& on_error = {}, OnCompleted&& on_completed = {}) |
There was a problem hiding this comment.
constructor accepting a forwarding reference can hide the copy and move constructors
| requires (!std::is_same_v<std::decay_t<TObserver>, dynamic_state_observer<T, States...>>) | ||
| dynamic_state_observer(TObserver&& obs) | ||
| requires (!std::is_same_v<std::decay_t<TObserver>, dynamic_observer<T>>) | ||
| dynamic_observer(TObserver&& obs) |
There was a problem hiding this comment.
constructor accepting a forwarding reference can hide the copy and move constructors
BENCHMARK RESULTS (AUTOGENERATED)ci-macosObservable constructionTable
Observable liftTable
Observable subscribeTable
Observable subscribe #2Table
Observer constructionTable
OnNextTable
Subscriber constructionTable
SubscriptionTable
bufferTable
chains creation testTable
combine_latestTable
concatTable
distinct_until_changedTable
firstTable
foundamental sourcesTable
fromTable
immediate schedulerTable
justTable
lastTable
mapTable
mergeTable
observe_onTable
on_error_resume_nextTable
publish_subject callbacksTable
publish_subject routinesTable
repeatTable
scanTable
single-threaded locksTable
skipTable
switch_on_nextTable
takeTable
take_lastTable
take_untilTable
timeoutTable
trampoline schedulerTable
windowTable
with_latest_fromTable
ci-ubuntu-clangObservable constructionTable
Observable liftTable
Observable subscribeTable
Observable subscribe #2Table
Observer constructionTable
OnNextTable
Subscriber constructionTable
SubscriptionTable
bufferTable
chains creation testTable
combine_latestTable
concatTable
distinct_until_changedTable
firstTable
foundamental sourcesTable
fromTable
immediate schedulerTable
justTable
lastTable
mapTable
mergeTable
observe_onTable
on_error_resume_nextTable
publish_subject callbacksTable
publish_subject routinesTable
repeatTable
scanTable
single-threaded locksTable
skipTable
switch_on_nextTable
takeTable
take_lastTable
take_untilTable
timeoutTable
trampoline schedulerTable
windowTable
with_latest_fromTable
ci-ubuntu-gccObservable constructionTable
Observable liftTable
Observable subscribeTable
Observable subscribe #2Table
Observer constructionTable
OnNextTable
Subscriber constructionTable
SubscriptionTable
bufferTable
chains creation testTable
combine_latestTable
concatTable
distinct_until_changedTable
firstTable
foundamental sourcesTable
fromTable
immediate schedulerTable
justTable
lastTable
mapTable
mergeTable
observe_onTable
on_error_resume_nextTable
publish_subject callbacksTable
publish_subject routinesTable
repeatTable
scanTable
single-threaded locksTable
skipTable
switch_on_nextTable
takeTable
take_lastTable
take_untilTable
timeoutTable
trampoline schedulerTable
windowTable
with_latest_fromTable
ci-windowsObservable constructionTable
Observable liftTable
Observable subscribeTable
Observable subscribe #2Table
Observer constructionTable
OnNextTable
Subscriber constructionTable
SubscriptionTable
bufferTable
chains creation testTable
combine_latestTable
concatTable
distinct_until_changedTable
firstTable
foundamental sourcesTable
fromTable
immediate schedulerTable
justTable
lastTable
mapTable
mergeTable
observe_onTable
on_error_resume_nextTable
publish_subject callbacksTable
publish_subject routinesTable
repeatTable
scanTable
single-threaded locksTable
skipTable
switch_on_nextTable
takeTable
take_lastTable
take_untilTable
timeoutTable
trampoline schedulerTable
windowTable
with_latest_fromTable
|
08d58eb to
5782347
Compare
| { | ||
| auto empty_observer = rpp::specific_observer<int>{}; | ||
|
|
||
| CHECK(sizeof(empty_observer) == 1); |
There was a problem hiding this comment.
the parameter sub is copied for each invocation but only used as a const reference; consider making it a const reference
| auto state_observer = rpp::details::state_observer_base{[](int v, rpp::dynamic_subscriber<int> sub) | |
| auto state_observer = rpp::details::state_observer_base{[](int v, const rpp::dynamic_subscriber<int> sub) |
| { | ||
| auto empty_observer = rpp::specific_observer<int>{}; | ||
|
|
||
| CHECK(sizeof(empty_observer) == 1); |
There was a problem hiding this comment.
the parameter sub is copied for each invocation but only used as a const reference; consider making it a const reference
| auto state_observer = rpp::details::state_observer_base{[](int v, rpp::dynamic_subscriber<int> sub) | |
| auto state_observer = rpp::details::state_observer_base{[](int v, rpp::dynamic_subscriber<int>& sub) |
|
Kudos, SonarCloud Quality Gate passed! |








No description provided.