Skip to content

Commit

Permalink
Add behavior subject (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
victimsnino authored Dec 5, 2022
1 parent 39974ba commit 8c6431e
Show file tree
Hide file tree
Showing 7 changed files with 213 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/Implementation Status.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
## Subjects

- [x] publish_subject
- [x] behavior_subject
- [ ] serialized_subject
- [ ] replay_subject
- [ ] publish_subject
- [ ] async_subject
3 changes: 2 additions & 1 deletion src/rpp/rpp/subjects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
* \ingroup rpp
*/

#include <rpp/subjects/publish_subject.hpp>
#include <rpp/subjects/publish_subject.hpp>
#include <rpp/subjects/behavior_subject.hpp>
139 changes: 139 additions & 0 deletions src/rpp/rpp/subjects/behavior_subject.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
// ReactivePlusPlus library
//
// Copyright Aleksey Loginov 2022 - present.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/victimsnino/ReactivePlusPlus

#pragma once

#include <rpp/subjects/fwd.hpp>
#include <rpp/utils/constraints.hpp>
#include <rpp/subscribers/dynamic_subscriber.hpp>
#include <rpp/subjects/details/subject_state.hpp>
#include <rpp/subjects/details/base_subject.hpp>

namespace rpp::subjects::details
{
template<rpp::constraint::decayed_type T>
class behavior_strategy
{
public:
template<rpp::constraint::decayed_same_as<T> TT, rpp::constraint::decayed_same_as<composite_subscription> TSub>
behavior_strategy(TT&& v, TSub&& sub)
: m_state{std::make_shared<behavior_state>(std::forward<TT>(v))}
, m_sub{std::forward<TSub>(sub)}
{
m_sub.add([state = std::weak_ptr{m_state}]
{
if (const auto locked = state.lock())
locked->on_unsubscribe();
});
}

void on_subscribe(const dynamic_subscriber<T>& sub) const
{
if (m_sub.is_subscribed())
sub.on_next(m_state->get_value());

m_state->on_subscribe(sub);
}

auto get_subscriber() const
{
return rpp::make_specific_subscriber<T>(m_sub,
[state = m_state](const T& v)
{
state->set_value(v);
state->on_next(v);
},
[state = m_state](const std::exception_ptr& err)
{
state->on_error(err);
},
[state = m_state]()
{
state->on_completed();
});
}

T get_value() const
{
return m_state->get_value();
}

private:
class behavior_state : public subject_state<T>
{
public:
behavior_state(const T& v)
: subject_state<T>{}
, value{v} {}

behavior_state(T&& v)
: subject_state<T>{}
, value{std::move(v)} {}

T get_value()
{
std::lock_guard lock{mutex};
return value;
}


void set_value(const T& v)
{
std::lock_guard lock{mutex};
value = v;
}

private:

std::mutex mutex;
T value;
};

std::shared_ptr<behavior_state> m_state;
composite_subscription m_sub{};
};
} // namespace rpp::subjects::details

namespace rpp::subjects
{
/**
* \brief Subject which multicasts values to observers subscribed on it and sends last emitted value (or initial value) on subscribe. It contains two parts: subscriber and observable at the same time.
*
* \details Each subscriber obtains only last/initial value + values which emitted after corresponding subscribe. on_error/on_completer/unsubscribe cached and provided to new subscribers if any
*
* \warning this subject is not synchronized/serialized! It means, that expected to call callbacks of subscriber in the serialized way to follow observable contract: "Observables must issue notifications to observers serially (not in parallel).". If you are not sure or need extra serialization, please, use serialized_subject.
*
* \tparam T value provided by this subject
*
* \ingroup subjects
* \see https://reactivex.io/documentation/subject.html
*/
template<rpp::constraint::decayed_type T>
class behavior_subject final : public details::base_subject<T, details::behavior_strategy<T>>
{
public:
behavior_subject(const T& initial_value, const composite_subscription& sub)
: details::base_subject<T, details::behavior_strategy<T>>{initial_value, sub} {}

behavior_subject(T&& initial_value, const composite_subscription& sub)
: details::base_subject<T, details::behavior_strategy<T>>{std::move(initial_value), sub} {}

behavior_subject(const T& initial_value, composite_subscription&& sub = composite_subscription{})
: details::base_subject<T, details::behavior_strategy<T>>{initial_value, std::move(sub)} {}

behavior_subject(T&& initial_value, composite_subscription&& sub = composite_subscription{})
: details::base_subject<T, details::behavior_strategy<T>>{std::move(initial_value), std::move(sub)} {}


T get_value() const
{
return details::base_subject<T, details::behavior_strategy<T>>::get_strategy().get_value();
}
};
} // namespace rpp::subjects
11 changes: 7 additions & 4 deletions src/rpp/rpp/subjects/details/base_subject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ template<rpp::constraint::decayed_type T, subject_strategy<T> Strategy>
class base_subject : public subject_tag
{
public:
base_subject(const composite_subscription& sub = composite_subscription{})
: m_strategy{sub} {}

auto get_subscriber() const
{
return m_strategy.get_subscriber();
Expand All @@ -38,7 +35,13 @@ class base_subject : public subject_tag
});
}

protected:
base_subject(auto&& ...args)
: m_strategy{std::forward<decltype(args)>(args)...} {}

const Strategy& get_strategy() const { return m_strategy; }

private:
Strategy m_strategy{};
};
} // namespace rpp::subjects::details
} // namespace rpp::subjects::details
5 changes: 4 additions & 1 deletion src/rpp/rpp/subjects/fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace rpp::subjects::details
struct subject_tag;

template<typename Strategy, typename T>
concept subject_strategy = std::constructible_from<Strategy, rpp::composite_subscription> && requires(Strategy t)
concept subject_strategy = requires(Strategy t)
{
{t.get_subscriber()} -> rpp::constraint::subscriber;
t.on_subscribe(std::declval<rpp::dynamic_subscriber<T>>());
Expand All @@ -32,4 +32,7 @@ namespace rpp::subjects
{
template<rpp::constraint::decayed_type T>
class publish_subject;

template<rpp::constraint::decayed_type T>
class behavior_subject;
} // namespace rpp::subjects
14 changes: 11 additions & 3 deletions src/rpp/rpp/subjects/publish_subject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ template<rpp::constraint::decayed_type T>
class publish_strategy
{
public:
publish_strategy(const composite_subscription& sub)
: m_sub{sub}
template<rpp::constraint::decayed_same_as<composite_subscription> TSub>
publish_strategy(TSub&& sub)
: m_sub{std::forward<TSub>(sub)}
{
m_sub.add([state = std::weak_ptr{m_state}]
{
Expand Down Expand Up @@ -74,5 +75,12 @@ namespace rpp::subjects
* \see https://reactivex.io/documentation/subject.html
*/
template<rpp::constraint::decayed_type T>
class publish_subject final : public details::base_subject<T, details::publish_strategy<T>>{};
class publish_subject final : public details::base_subject<T, details::publish_strategy<T>>{
public:
publish_subject(const composite_subscription& sub)
: details::base_subject<T, details::publish_strategy<T>>{sub} {}

publish_subject(composite_subscription&& sub = composite_subscription{})
: details::base_subject<T, details::publish_strategy<T>>{std::move(sub)} {}
};
} // namespace rpp::subjects
50 changes: 49 additions & 1 deletion src/tests/rpp/test_subjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "mock_observer.hpp"

#include <catch2/catch_test_macros.hpp>
#include <rpp/subjects/behavior_subject.hpp>
#include <rpp/subjects/publish_subject.hpp>

SCENARIO("publish subject multicasts values")
Expand Down Expand Up @@ -231,4 +232,51 @@ SCENARIO("publish subject caches error/completed/unsubscribe")
}
}
}
}
}

SCENARIO("behavior subject caches last emission")
{
auto mock = mock_observer<int>{};
GIVEN("behavior subject")
{
auto subj = rpp::subjects::behavior_subject<int>{100};
WHEN("subscribe on it")
{
subj.get_observable().subscribe(mock);
THEN("subject emits initial value on subscribe")
{
CHECK(mock.get_received_values() == std::vector{100});
CHECK(mock.get_on_error_count() == 0);
CHECK(mock.get_on_completed_count() == 0);
}
}
WHEN("send new value to subject")
{
subj.get_subscriber().on_next(5);
AND_WHEN("subscribe on it")
{
subj.get_observable().subscribe(mock);
THEN("subject emits last value on subscribe")
{
CHECK(mock.get_received_values() == std::vector{5});
CHECK(mock.get_on_error_count() == 0);
CHECK(mock.get_on_completed_count() == 0);
}
}
}
WHEN("complete subject")
{
subj.get_subscriber().on_completed();
AND_WHEN("subscribe on it")
{
subj.get_observable().subscribe(mock);
THEN("subject emits completion on subscribe")
{
CHECK(mock.get_received_values() == std::vector<int>{});
CHECK(mock.get_on_error_count() == 0);
CHECK(mock.get_on_completed_count() == 1);
}
}
}
}
}

1 comment on commit 8c6431e

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

BENCHMARK RESULTS (AUTOGENERATED)

ci-macos

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 0.27ns 0.277717 0.99 0.28ns
Dynamic observable construction 68.03ns 88.0895 0.77 107.74ns
Specific observable construction + as_dynamic 67.20ns 71.7051 0.94 106.06ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 130.18ns 134.482 0.97 1115.18ns
Specific observable lift dynamic observer 155.29ns 160.659 0.97 1141.04ns
Dynamic observable lift specific observer 252.08ns 262.611 0.96 1296.01ns
Dynamic observable lift dynamic observer 201.81ns 215.569 0.94 1225.09ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 108.22ns 118.406 0.91 1135.19ns
Specific observable subscribe dynamic observer 119.93ns 133.775 0.90 1136.70ns
Dynamic observable subscribe specific observer 197.40ns 254.168 0.78 1203.94ns
Dynamic observable subscribe dynamic observer 157.18ns 152.51 1.03 1113.11ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 124.36ns 104.526 1.19 1243.46ns
Dynamic observable subscribe lambda 216.56ns 223.433 0.97 1181.84ns
Specific observable subscribe lambda without subscription 106.70ns 115.766 0.92 1109.61ns
Dynamic observable subscribe lambda without subscription 208.93ns 211.575 0.99 1264.36ns
Specific observable subscribe specific subscriber 30.16ns 45.225 0.67 784.03ns
Dynamic observable subscribe specific subscriber 129.69ns 131.038 0.99 945.82ns
Specific observable subscribe dynamic observer 45.00ns 46.8377 0.96 818.57ns
Dynamic observable subscribe dynamic observer 71.83ns 70.7723 1.01 830.58ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 0.28ns 0.278933 1.00 0.28ns
Dynamic observer construction 80.86ns 66.7409 1.21 100.38ns
Specific observer construction + as_dynamic 68.30ns 68.1397 1.00 97.09ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.78ns 0.777615 1.00 0.76ns
Dynamic observer OnNext 2.14ns 2.10217 1.02 2.12ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 75.00ns 70.7649 1.06 294.30ns
Make copy of subscriber 12.25ns 13.7521 0.89 24.63ns
Transform subsriber to dynamic 82.70ns 85.879 0.96 126.68ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 77.02ns 75.9054 1.01 295.41ns
composite_subscription add 55.46ns 55.4377 1.00 104.63ns
composite_subscription unsubscribe 72.48ns 69.9727 1.04 77.28ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 328.00ns 328.406 1.00 3034.15ns
sending of values from observable via buffer to subscriber 5.83ns 6.53838 0.89 87.40ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 216.07ns 214.456 1.01 1302.28ns
long stateful chain creation + subscribe 544.94ns 525.012 1.04 2609.37ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 1280.98ns 1329.69 0.96 .
sending of values from observable via combine_latest to subscriber 30.79ns 28.1057 1.10 .

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 3863.31ns 2593.05 1.49 9214.00ns
concat_with 3123.05ns 3048.7 1.02 10376.90ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 144.91ns 164.09 0.88 848.00ns
sending of values from observable via distinct_until_changed to subscriber 2.23ns 2.24993 0.99 1.11ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 121.08ns 118.328 1.02 2170.41ns
sending of values from observable via first to subscriber 0.84ns 0.83931 1.00 0.84ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 61.34ns 91.2841 0.67 2131.24ns
error 108.05ns 108.514 1.00 2248.13ns
never 31.90ns 32.0585 1.00 812.28ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 147.81ns 139.059 1.06 2230.78ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 1.98ns 2.2335 0.88 402.17ns
re-schedule 10 times 25.68ns 25.5044 1.01 408.36ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 64.02ns 63.9897 1.00 2119.62ns
just send variadic 94.11ns 103.061 0.91 2247.87ns

last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
last construction from observable via dot + subscribe 214.96ns 207.472 1.04 1175.97ns
sending of values from observable via last to subscriber 2.58ns 2.48502 1.04 1.27ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 65.80ns 64.7687 1.02 849.00ns
sending of values from observable via map to subscriber 1.12ns 1.14394 0.98 1.36ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 2756.75ns 2569.89 1.07 9385.19ns
merge_with 3130.63ns 3140.35 1.00 10118.10ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 624.54ns 648.505 0.96 48262.40ns
sending of values from observable via observe_on to subscriber 97.04ns 101.29 0.96 1068.47ns

on_error_resume_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_error_resume_next construction from observable via dot + subscribe 581.04ns 568.111 1.02 1516.34ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 20.66ns 20.7318 1.00 27.09ns
on_error 0.58ns 0.56714 1.02 17.00ns
on_completed 0.56ns 0.570642 0.99 2.24ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 350.90ns 326.759 1.07 519.62ns
get_observable 26.69ns 26.4345 1.01 152.20ns
get_subscriber 52.24ns 51.7053 1.01 73.85ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 5233.06ns 5537.34 0.95 8589.72ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 153.82ns 141.953 1.08 1115.64ns
sending of values from observable via scan to subscriber 3.15ns 2.57127 1.22 1.90ns

single-threaded locks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no-lock increment 1.86ns 1.78693 1.04 .
mutex lock increment 22.96ns 22.8849 1.00 .
spin-lock increment 8.28ns 8.18933 1.01 .

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 143.21ns 158.381 0.90 1345.70ns
sending of values from observable via skip to subscriber 2.24ns 2.21336 1.01 1.85ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 3095.33ns 3181.66 0.97 9981.99ns
sending of values from observable via switch_on_next to subscriber 754.83ns 804.81 0.94 2568.21ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 192.44ns 212.262 0.91 1785.08ns
sending of values from observable via take to subscriber 2.74ns 2.72246 1.01 5.58ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 293.85ns 291.773 1.01 1993.48ns
sending of values from observable via take_last to subscriber 2.72ns 2.7138 1.00 5.14ns

take_until

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_until construction from observable via dot + subscribe 1497.86ns 1485.59 1.01 4557.15ns
sending of values from observable via take_until to subscriber 7.79ns 7.80105 1.00 2.30ns

timeout

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
timeout construction from observable via dot + subscribe with run_loop 6584.30ns 6221.39 1.06 4098.47ns
sending of values from observable via timeout to subscriber with unreachable timeout interval with run_loop 68.31ns 68.7301 0.99 863.94ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 42.91ns 42.7089 1.00 566.38ns
re-schedule 10 times 114.34ns 85.9416 1.33 634.96ns
recursively schedule 10 times 1930.72ns 1904.53 1.01 15637.70ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 2907.95ns 3033.75 0.96 8240.50ns
sending of values from observable via window to subscriber 810.91ns 843.619 0.96 1398.05ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 1544.00ns 1586.76 0.97 .
sending of values from observable via with_latest_from to subscriber 27.33ns 27.6929 0.99 .

ci-ubuntu-clang

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 0.34ns 0.335415 1.00 0.33ns
Dynamic observable construction 29.24ns 29.2324 1.00 24.75ns
Specific observable construction + as_dynamic 29.17ns 29.1828 1.00 24.46ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 88.84ns 89.0336 1.00 286.54ns
Specific observable lift dynamic observer 110.92ns 110.987 1.00 309.24ns
Dynamic observable lift specific observer 170.89ns 169.62 1.01 336.04ns
Dynamic observable lift dynamic observer 173.64ns 173.115 1.00 320.15ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 57.91ns 57.9734 1.00 285.56ns
Specific observable subscribe dynamic observer 71.61ns 71.5795 1.00 294.60ns
Dynamic observable subscribe specific observer 126.78ns 126.955 1.00 338.96ns
Dynamic observable subscribe dynamic observer 120.63ns 121.649 0.99 317.77ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 58.18ns 58.0986 1.00 289.44ns
Dynamic observable subscribe lambda 124.33ns 124.493 1.00 327.08ns
Specific observable subscribe lambda without subscription 58.01ns 58.0486 1.00 283.68ns
Dynamic observable subscribe lambda without subscription 124.31ns 124.348 1.00 328.05ns
Specific observable subscribe specific subscriber 27.84ns 27.8526 1.00 218.68ns
Dynamic observable subscribe specific subscriber 88.29ns 88.2562 1.00 268.01ns
Specific observable subscribe dynamic observer 27.83ns 27.7897 1.00 236.10ns
Dynamic observable subscribe dynamic observer 75.30ns 75.3822 1.00 256.38ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 0.33ns 0.334808 1.00 0.34ns
Dynamic observer construction 29.15ns 29.1528 1.00 22.00ns
Specific observer construction + as_dynamic 29.19ns 29.2035 1.00 21.69ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.67ns 0.670392 1.00 0.67ns
Dynamic observer OnNext 2.01ns 2.01207 1.00 2.35ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 35.04ns 34.8274 1.01 67.24ns
Make copy of subscriber 16.76ns 16.743 1.00 4.70ns
Transform subsriber to dynamic 45.86ns 45.8782 1.00 27.00ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 34.88ns 34.8681 1.00 53.77ns
composite_subscription add 49.13ns 49.2212 1.00 93.75ns
composite_subscription unsubscribe 44.06ns 44.039 1.00 23.81ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 244.77ns 244.739 1.00 1885.09ns
sending of values from observable via buffer to subscriber 5.03ns 5.01944 1.00 27.56ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 260.45ns 260.897 1.00 528.22ns
long stateful chain creation + subscribe 378.57ns 376.989 1.00 1443.13ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 856.69ns 863.07 0.99 .
sending of values from observable via combine_latest to subscriber 27.47ns 27.4476 1.00 .

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 1854.15ns 1874.89 0.99 3252.74ns
concat_with 2162.74ns 2160.08 1.00 3670.05ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 112.64ns 112.712 1.00 245.96ns
sending of values from observable via distinct_until_changed to subscriber 2.68ns 2.67862 1.00 2.35ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 122.81ns 123.45 0.99 587.78ns
sending of values from observable via first to subscriber 0.67ns 0.670977 1.00 0.67ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 63.53ns 63.8468 0.99 636.03ns
error 114.13ns 116.151 0.98 744.15ns
never 28.68ns 28.618 1.00 250.44ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 80.21ns 80.7336 0.99 653.40ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 0.67ns 0.671513 1.00 111.92ns
re-schedule 10 times 9.39ns 9.39149 1.00 142.72ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 64.83ns 64.7432 1.00 630.51ns
just send variadic 95.51ns 95.8723 1.00 745.76ns

last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
last construction from observable via dot + subscribe 168.19ns 168.069 1.00 366.35ns
sending of values from observable via last to subscriber 2.09ns 2.07931 1.00 1.68ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 68.83ns 69.0534 1.00 239.71ns
sending of values from observable via map to subscriber 1.01ns 1.0057 1.00 1.52ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 1807.02ns 1824.19 0.99 3264.74ns
merge_with 2109.81ns 2122.87 0.99 3545.16ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 429.68ns 428.744 1.00 2589.65ns
sending of values from observable via observe_on to subscriber 60.67ns 60.3631 1.01 199.07ns

on_error_resume_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_error_resume_next construction from observable via dot + subscribe 419.89ns 421.313 1.00 937.09ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 24.09ns 24.0539 1.00 10.79ns
on_error 0.51ns 0.505876 1.00 19.18ns
on_completed 0.50ns 0.506086 1.00 0.67ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 198.52ns 201.055 0.99 180.78ns
get_observable 29.12ns 29.0671 1.00 49.45ns
get_subscriber 60.49ns 60.5922 1.00 13.69ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 3935.43ns 3925.28 1.00 3093.84ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 99.44ns 99.5372 1.00 295.94ns
sending of values from observable via scan to subscriber 1.67ns 1.67259 1.00 2.01ns

single-threaded locks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no-lock increment 2.02ns 2.02279 1.00 .
mutex lock increment 18.08ns 18.1001 1.00 .
spin-lock increment 9.04ns 9.03712 1.00 .

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 99.17ns 98.5595 1.01 485.79ns
sending of values from observable via skip to subscriber 1.67ns 1.67677 1.00 1.72ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 2205.89ns 2212.23 1.00 2883.44ns
sending of values from observable via switch_on_next to subscriber 569.14ns 568.947 1.00 650.30ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 167.67ns 168.515 0.99 496.60ns
sending of values from observable via take to subscriber 2.35ns 2.34759 1.00 2.78ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 210.81ns 212.297 0.99 558.32ns
sending of values from observable via take_last to subscriber 3.14ns 3.13363 1.00 3.55ns

take_until

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_until construction from observable via dot + subscribe 1028.22ns 1030.8 1.00 1197.55ns
sending of values from observable via take_until to subscriber 10.18ns 9.04156 1.13 1.79ns

timeout

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
timeout construction from observable via dot + subscribe with run_loop 1066.77ns 1079.0 0.99 14566.60ns
sending of values from observable via timeout to subscriber with unreachable timeout interval with run_loop 55.77ns 57.4825 0.97 14375.90ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 12.41ns 13.0509 0.95 157.92ns
re-schedule 10 times 31.85ns 31.861 1.00 190.46ns
recursively schedule 10 times 1416.79ns 1397.85 1.01 7601.70ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 1956.59ns 2001.61 0.98 3033.74ns
sending of values from observable via window to subscriber 531.24ns 544.503 0.98 370.67ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 1020.55ns 1023.62 1.00 .
sending of values from observable via with_latest_from to subscriber 26.81ns 26.8252 1.00 .

ci-ubuntu-gcc

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 0.33ns 0.401376 0.83 0.34ns
Dynamic observable construction 31.55ns 28.6839 1.10 22.36ns
Specific observable construction + as_dynamic 31.60ns 28.9046 1.09 23.09ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 97.86ns 95.1961 1.03 336.60ns
Specific observable lift dynamic observer 126.63ns 128.938 0.98 359.68ns
Dynamic observable lift specific observer 182.06ns 186.897 0.97 395.48ns
Dynamic observable lift dynamic observer 194.07ns 202.542 0.96 375.39ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 60.99ns 60.1005 1.01 326.27ns
Specific observable subscribe dynamic observer 79.11ns 76.6126 1.03 333.75ns
Dynamic observable subscribe specific observer 129.87ns 129.96 1.00 371.21ns
Dynamic observable subscribe dynamic observer 127.66ns 132.918 0.96 348.65ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 60.91ns 59.2996 1.03 323.50ns
Dynamic observable subscribe lambda 130.83ns 128.951 1.01 371.27ns
Specific observable subscribe lambda without subscription 60.72ns 59.1905 1.03 327.58ns
Dynamic observable subscribe lambda without subscription 130.68ns 128.885 1.01 369.74ns
Specific observable subscribe specific subscriber 30.46ns 26.9694 1.13 269.46ns
Dynamic observable subscribe specific subscriber 97.13ns 97.3333 1.00 312.46ns
Specific observable subscribe dynamic observer 30.42ns 27.8745 1.09 274.64ns
Dynamic observable subscribe dynamic observer 85.11ns 90.8031 0.94 306.46ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 0.33ns 0.401307 0.83 0.34ns
Dynamic observer construction 31.50ns 29.0772 1.08 21.00ns
Specific observer construction + as_dynamic 31.48ns 28.7453 1.10 20.64ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.34ns 0.422513 0.79 0.34ns
Dynamic observer OnNext 1.68ns 1.60829 1.05 2.01ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 34.53ns 33.5029 1.03 65.81ns
Make copy of subscriber 16.72ns 16.0547 1.04 4.50ns
Transform subsriber to dynamic 44.49ns 44.6488 1.00 26.30ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 34.49ns 33.5417 1.03 59.34ns
composite_subscription add 49.43ns 51.9188 0.95 103.49ns
composite_subscription unsubscribe 41.65ns 45.5 0.92 22.02ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 235.56ns 237.097 0.99 1932.26ns
sending of values from observable via buffer to subscriber 6.38ns 6.61123 0.96 31.35ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 288.57ns 327.034 0.88 682.98ns
long stateful chain creation + subscribe 424.86ns 451.954 0.94 1498.20ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 905.77ns 944.586 0.96 .
sending of values from observable via combine_latest to subscriber 28.46ns 33.6949 0.84 .

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 1911.83ns 2039.47 0.94 3665.80ns
concat_with 2252.16ns 2423.75 0.93 3954.28ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 120.21ns 122.134 0.98 355.98ns
sending of values from observable via distinct_until_changed to subscriber 2.71ns 3.22118 0.84 1.34ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 137.91ns 146.734 0.94 697.49ns
sending of values from observable via first to subscriber 1.01ns 1.20636 0.83 1.01ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 68.61ns 68.1741 1.01 786.29ns
error 116.75ns 123.259 0.95 849.37ns
never 32.37ns 29.1744 1.11 282.82ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 86.78ns 83.2166 1.04 763.91ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 1.34ns 0.803877 1.67 129.98ns
re-schedule 10 times 22.44ns 18.9685 1.18 155.78ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 70.40ns 71.1152 0.99 786.67ns
just send variadic 111.69ns 94.6111 1.18 851.09ns

last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
last construction from observable via dot + subscribe 176.10ns 184.304 0.96 429.11ns
sending of values from observable via last to subscriber 2.08ns 1.72703 1.20 1.34ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 82.03ns 78.5757 1.04 342.73ns
sending of values from observable via map to subscriber 0.75ns 1.11608 0.68 2.69ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 1864.70ns 1987.27 0.94 3742.40ns
merge_with 2202.02ns 2373.77 0.93 4218.16ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 465.68ns 490.889 0.95 2865.11ns
sending of values from observable via observe_on to subscriber 63.92ns 72.3766 0.88 242.24ns

on_error_resume_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_error_resume_next construction from observable via dot + subscribe 434.68ns 453.769 0.96 830.49ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 22.42ns 29.328 0.76 9.59ns
on_error 0.67ns 1.21251 0.56 16.84ns
on_completed 1.35ns 0.80863 1.67 1.01ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 208.77ns 216.2 0.97 174.64ns
get_observable 29.44ns 30.5483 0.96 48.01ns
get_subscriber 57.39ns 64.0132 0.90 23.13ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 4090.41ns 4358.57 0.94 3221.62ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 115.80ns 112.465 1.03 384.77ns
sending of values from observable via scan to subscriber 2.02ns 2.00878 1.00 1.67ns

single-threaded locks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no-lock increment 2.01ns 1.89966 1.06 .
mutex lock increment 18.05ns 36.5937 0.49 .
spin-lock increment 9.04ns 10.426 0.87 .

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 114.66ns 112.7 1.02 555.18ns
sending of values from observable via skip to subscriber 2.35ns 3.2337 0.73 2.35ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 2309.01ns 2442.58 0.95 4408.46ns
sending of values from observable via switch_on_next to subscriber 604.26ns 629.106 0.96 1065.08ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 173.57ns 176.43 0.98 602.73ns
sending of values from observable via take to subscriber 3.51ns 4.04918 0.87 3.50ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 207.37ns 210.54 0.98 635.40ns
sending of values from observable via take_last to subscriber 3.11ns 2.76611 1.12 6.05ns

take_until

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_until construction from observable via dot + subscribe 1075.54ns 1099.96 0.98 1579.56ns
sending of values from observable via take_until to subscriber 9.04ns 10.4377 0.87 1.79ns

timeout

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
timeout construction from observable via dot + subscribe with run_loop 1139.45ns 1156.45 0.99 24521.40ns
sending of values from observable via timeout to subscriber with unreachable timeout interval with run_loop 60.49ns 62.7198 0.96 20224.30ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 22.47ns 20.2618 1.11 181.93ns
re-schedule 10 times 50.39ns 44.2406 1.14 206.00ns
recursively schedule 10 times 1598.49ns 1405.19 1.14 9203.87ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 2094.15ns 2193.57 0.95 3200.62ns
sending of values from observable via window to subscriber 573.22ns 600.898 0.95 413.66ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 1072.37ns 1128.46 0.95 .
sending of values from observable via with_latest_from to subscriber 26.73ns 31.7546 0.84 .

ci-windows

Observable construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable construction 1.50ns 1.81506 0.83 0.67ns
Dynamic observable construction 79.49ns 111.094 0.72 122.94ns
Specific observable construction + as_dynamic 79.59ns 97.9837 0.81 122.64ns

Observable lift

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable lift specific observer 145.09ns 176.791 0.82 1216.48ns
Specific observable lift dynamic observer 180.42ns 299.354 0.60 1275.43ns
Dynamic observable lift specific observer 287.19ns 340.478 0.84 1418.00ns
Dynamic observable lift dynamic observer 237.80ns 282.841 0.84 1307.80ns

Observable subscribe

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe specific observer 112.87ns 132.939 0.85 1217.77ns
Specific observable subscribe dynamic observer 132.65ns 156.284 0.85 1210.71ns
Dynamic observable subscribe specific observer 228.62ns 274.637 0.83 1368.79ns
Dynamic observable subscribe dynamic observer 181.74ns 220.569 0.82 1237.00ns

Observable subscribe #2

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observable subscribe lambda 113.93ns 134.882 0.84 1168.14ns
Dynamic observable subscribe lambda 228.01ns 275.768 0.83 1361.74ns
Specific observable subscribe lambda without subscription 113.59ns 134.132 0.85 1180.09ns
Dynamic observable subscribe lambda without subscription 229.51ns 284.46 0.81 1364.32ns
Specific observable subscribe specific subscriber 30.83ns 36.6311 0.84 840.93ns
Dynamic observable subscribe specific subscriber 147.92ns 177.798 0.83 1025.24ns
Specific observable subscribe dynamic observer 30.79ns 36.6094 0.84 884.97ns
Dynamic observable subscribe dynamic observer 79.05ns 98.5796 0.80 912.54ns

Observer construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer construction 1.50ns 1.80449 0.83 1.51ns
Dynamic observer construction 81.18ns 99.7185 0.81 117.86ns
Specific observer construction + as_dynamic 81.45ns 100.034 0.81 115.07ns

OnNext

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Specific observer OnNext 0.67ns 0.803065 0.84 0.67ns
Dynamic observer OnNext 1.67ns 2.01359 0.83 1.70ns

Subscriber construction

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
Make subsriber 87.68ns 100.839 0.87 350.41ns
Make copy of subscriber 17.14ns 20.0555 0.85 31.43ns
Transform subsriber to dynamic 95.76ns 116.929 0.82 156.46ns

Subscription

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
composite_subscription create 86.00ns 100.889 0.85 342.90ns
composite_subscription add 70.96ns 84.4586 0.84 156.49ns
composite_subscription unsubscribe 63.09ns 124.351 0.51 128.33ns

buffer

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
buffer 352.80ns 428.493 0.82 4580.50ns
sending of values from observable via buffer to subscriber 7.05ns 8.36743 0.84 91.00ns

chains creation test

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
long non-state chain creation + subscribe 268.68ns 319.012 0.84 1738.71ns
long stateful chain creation + subscribe 659.49ns 791.028 0.83 3170.25ns

combine_latest

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
combine_latest construction from observable via dot + subscribe 1650.38ns 1979.47 0.83 .
sending of values from observable via combine_latest to subscriber 47.08ns 57.2744 0.82 .

concat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
concat 2735.00ns 3321.89 0.82 10562.30ns
concat_with 3407.88ns 4107.88 0.83 11700.00ns

distinct_until_changed

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
distinct_until_changed construction from observable via dot + subscribe 183.52ns 220.059 0.83 1024.88ns
sending of values from observable via distinct_until_changed to subscriber 4.67ns 5.52271 0.85 4.27ns

first

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
first construction from observable via dot + subscribe 127.84ns 153.236 0.83 2620.10ns
sending of values from observable via first to subscriber 2.35ns 2.81475 0.83 1.77ns

foundamental sources

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
empty 64.10ns 76.0759 0.84 2406.36ns
error 113.49ns 135.663 0.84 2481.60ns
never 30.77ns 38.5048 0.80 888.92ns

from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
from vector with int 134.84ns 162.183 0.83 2464.00ns

immediate scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 2.14ns 2.4114 0.89 409.90ns
re-schedule 10 times 97.73ns 117.427 0.83 439.52ns

just

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
just send int 68.08ns 78.9722 0.86 2408.55ns
just send variadic 103.33ns 125.673 0.82 2476.50ns

last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
last construction from observable via dot + subscribe 222.48ns 265.275 0.84 1431.65ns
sending of values from observable via last to subscriber 3.19ns 3.83523 0.83 3.33ns

map

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
map construction from observable via dot + subscribe 87.89ns 106.32 0.83 994.35ns
sending of values from observable via map to subscriber 4.01ns 4.81923 0.83 7.47ns

merge

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
merge 2656.20ns 3241.1 0.82 10940.70ns
merge_with 3333.88ns 4003.75 0.83 11599.30ns

observe_on

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
observe_on construction from observable via dot + subscribe 617.95ns 747.474 0.83 5533.00ns
sending of values from observable via observe_on to subscriber 63.68ns 82.7074 0.77 914.00ns

on_error_resume_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_error_resume_next construction from observable via dot + subscribe 640.90ns 762.975 0.84 1867.15ns

publish_subject callbacks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
on_next 19.72ns 24.4964 0.81 32.54ns
on_error 3.07ns 3.65481 0.84 19.11ns
on_completed 3.03ns 3.64565 0.83 0.68ns

publish_subject routines

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
construct 350.51ns 429.824 0.82 598.62ns
get_observable 28.41ns 34.5447 0.82 163.11ns
get_subscriber 50.21ns 60.2407 0.83 93.77ns

repeat

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
repeat construction from observable via dot + subscribe 6009.40ns 7833.0 0.77 11225.70ns

scan

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
scan construction from observable via dot + subscribe 185.50ns 225.75 0.82 1249.48ns
sending of values from observable via scan to subscriber 6.35ns 7.22499 0.88 8.85ns

single-threaded locks

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no-lock increment 1.89ns 2.2576 0.84 .
mutex lock increment 25.73ns 31.0758 0.83 .
spin-lock increment 9.03ns 10.8513 0.83 .

skip

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
skip construction from observable via dot + subscribe 176.69ns 208.924 0.85 1539.60ns
sending of values from observable via skip to subscriber 4.35ns 4.08183 1.07 3.49ns

switch_on_next

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
switch_on_next construction from observable via dot + subscribe 3511.88ns 4270.57 0.82 12047.00ns
sending of values from observable via switch_on_next to subscriber 855.77ns 1023.62 0.84 3095.89ns

take

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take construction from observable via dot + subscribe 230.22ns 269.42 0.85 2192.83ns
sending of values from observable via take to subscriber 5.49ns 6.71063 0.82 6.47ns

take_last

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_last construction from observable via dot + subscribe 323.03ns 389.219 0.83 2434.00ns
sending of values from observable via take_last to subscriber 4.41ns 5.30824 0.83 20.61ns

take_until

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
take_until construction from observable via dot + subscribe 1577.56ns 1905.94 0.83 5202.40ns
sending of values from observable via take_until to subscriber 11.41ns 13.7851 0.83 5.54ns

timeout

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
timeout construction from observable via dot + subscribe with run_loop 1671.23ns 1951.23 0.86 5592.50ns
sending of values from observable via timeout to subscriber with unreachable timeout interval with run_loop 55.14ns 65.1962 0.85 1442.87ns

trampoline scheduler

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
no any re-schedule 19.90ns 24.7802 0.80 611.60ns
re-schedule 10 times 122.30ns 146.427 0.84 643.30ns
recursively schedule 10 times 2612.00ns 3261.8 0.80 19093.00ns

window

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
window 2891.11ns 3518.89 0.82 9704.33ns
sending of values from observable via window to subscriber 824.71ns 1007.71 0.82 1628.19ns

with_latest_from

Table
Test Name Current, ns Prev, ns Ratio RxCpp current, ns
with_latest_from construction from observable via dot + subscribe 1972.00ns 2404.42 0.82 .
sending of values from observable via with_latest_from to subscriber 38.11ns 45.3145 0.84 .

Please sign in to comment.