YarikTH / ureact

Functional reactive programming library for c++
Boost Software License 1.0
155 stars 10 forks source link

Try to mesure and improve compile times #126

Open YarikTH opened 1 year ago

YarikTH commented 1 year ago

Description

According to some previous compile time benchmarks, it seems that my decision about reducing about of node classes and doing most of the work of adapters via ureact::process and ureact::fold somehow leads to worse compilation times. Need to measure it again, maybe compare with cpp.react somehow and try to improve them.

At some moment I tried to move all the tests in the single cpp file and compilation time become unacceptable low. I don't know about cpp.react, but ureact hurts from build timings for some reason.

YarikTH commented 1 year ago

There is an idea that using lambda instead of named functor class might hurt performance

template <size_t N>
inline constexpr auto elements = transform( []( const auto& e ) { return std::get<N>( e ); } );

But it is just idea that should be tested.

YarikTH commented 1 year ago

For some reason including <iterator> in <ureact/detail/algorithm.hpp> to implement <algorithm> replacement, has negative impact on compilation time, sometimes even worse than inclusion of <algorithm> itself:

g++-12     c++17           Debug    - 33.65%  136.13ms
g++-12     c++17           Release  - 30.95%  121.16ms
clang++-11 c++17 libstdc++ Debug    - 23.60%  93.72ms
clang++-11 c++17 libstdc++ Release  - 22.38%  88.89ms
clang++-14 c++17 libstdc++ Debug    - 22.69%  94.27ms
clang++-14 c++17 libstdc++ Release  - 23.90%  99.61ms

On these configurations even direct usage of <algorithm> is better.

So, it's better to add replacements for needed things from <iterator> too if ureact works with std algorithm replacements.

YarikTH commented 1 year ago
| relative |               ms/op |                op/s |    err% |     total | std headers include time
|---------:|--------------------:|--------------------:|--------:|----------:|:-------------------------
|   100.0% |               43.57 |               22.95 |    0.6% |      0.48 | `baseline (g++-9 c++17 Debug)`
|    21.5% |              202.23 |                4.94 |    0.3% |      2.22 | `std (g++-9 c++17 Debug)`
|    19.7% |              221.16 |                4.52 |    0.2% |      2.43 | `std+vector (g++-9 c++17 Debug)`
|    20.1% |              216.63 |                4.62 |    0.2% |      2.39 | `std+deque (g++-9 c++17 Debug)`
|    18.6% |              233.88 |                4.28 |    0.1% |      2.57 | `std+memory (g++-9 c++17 Debug)`
|    16.9% |              258.46 |                3.87 |    0.2% |      2.85 | `std+iterator (g++-9 c++17 Debug)`
|    14.2% |              306.62 |                3.26 |    0.1% |      3.37 | `std+functional (g++-9 c++17 Debug)`
|    14.0% |              310.62 |                3.22 |    0.2% |      3.42 | `std+algorithm (g++-9 c++17 Debug)`
|    12.6% |              344.77 |                2.90 |    0.1% |      3.79 | `std+all (g++-9 c++17 Debug)`
|    99.9% |               43.60 |               22.94 |    0.4% |      0.48 | `baseline (g++-9 c++2a Debug)`
|    18.8% |              231.87 |                4.31 |    0.2% |      2.55 | `std (g++-9 c++2a Debug)`
|    17.5% |              249.33 |                4.01 |    0.2% |      2.74 | `std+vector (g++-9 c++2a Debug)`
|    17.8% |              244.39 |                4.09 |    0.1% |      2.69 | `std+deque (g++-9 c++2a Debug)`
|    16.5% |              263.90 |                3.79 |    0.1% |      2.90 | `std+memory (g++-9 c++2a Debug)`
|    15.0% |              290.84 |                3.44 |    0.0% |      3.20 | `std+iterator (g++-9 c++2a Debug)`
|    13.4% |              324.18 |                3.08 |    0.2% |      3.57 | `std+functional (g++-9 c++2a Debug)`
|    13.3% |              327.43 |                3.05 |    0.2% |      3.60 | `std+algorithm (g++-9 c++2a Debug)`
|    11.9% |              367.67 |                2.72 |    0.2% |      4.04 | `std+all (g++-9 c++2a Debug)`
|    98.6% |               44.18 |               22.63 |    0.5% |      0.49 | `baseline (g++-9 c++17 Release)`
|    23.3% |              186.70 |                5.36 |    0.1% |      2.06 | `std (g++-9 c++17 Release)`
|    21.2% |              205.06 |                4.88 |    0.1% |      2.26 | `std+vector (g++-9 c++17 Release)`
|    21.7% |              200.46 |                4.99 |    0.1% |      2.20 | `std+deque (g++-9 c++17 Release)`
|    20.1% |              216.92 |                4.61 |    0.2% |      2.39 | `std+memory (g++-9 c++17 Release)`
|    18.1% |              241.01 |                4.15 |    0.2% |      2.65 | `std+iterator (g++-9 c++17 Release)`
|    15.4% |              283.45 |                3.53 |    0.2% |      3.12 | `std+functional (g++-9 c++17 Release)`
|    15.2% |              286.86 |                3.49 |    0.1% |      3.15 | `std+algorithm (g++-9 c++17 Release)`
|    13.6% |              321.47 |                3.11 |    0.1% |      3.54 | `std+all (g++-9 c++17 Release)`
|    98.9% |               44.07 |               22.69 |    0.6% |      0.48 | `baseline (g++-9 c++2a Release)`
|    20.6% |              211.57 |                4.73 |    0.1% |      2.33 | `std (g++-9 c++2a Release)`
|    19.1% |              228.11 |                4.38 |    0.2% |      2.51 | `std+vector (g++-9 c++2a Release)`
|    19.5% |              224.03 |                4.46 |    0.3% |      2.47 | `std+deque (g++-9 c++2a Release)`
|    18.0% |              242.65 |                4.12 |    0.1% |      2.67 | `std+memory (g++-9 c++2a Release)`
|    16.3% |              268.06 |                3.73 |    0.2% |      2.95 | `std+iterator (g++-9 c++2a Release)`
|    14.7% |              296.79 |                3.37 |    0.1% |      3.26 | `std+functional (g++-9 c++2a Release)`
|    14.6% |              299.33 |                3.34 |    0.1% |      3.30 | `std+algorithm (g++-9 c++2a Release)`
|    12.8% |              340.50 |                2.94 |    0.0% |      3.75 | `std+all (g++-9 c++2a Release)`
|    98.1% |               44.42 |               22.51 |    0.9% |      0.49 | `baseline (g++-10 c++17 Debug)`
|    42.9% |              101.49 |                9.85 |    0.2% |      1.12 | `std (g++-10 c++17 Debug)`
|    33.9% |              128.56 |                7.78 |    0.2% |      1.41 | `std+vector (g++-10 c++17 Debug)`
|    36.2% |              120.22 |                8.32 |    0.2% |      1.32 | `std+deque (g++-10 c++17 Debug)`
|    27.6% |              158.06 |                6.33 |    0.2% |      1.74 | `std+memory (g++-10 c++17 Debug)`
|    18.2% |              240.03 |                4.17 |    0.1% |      2.64 | `std+iterator (g++-10 c++17 Debug)`
|    19.2% |              227.08 |                4.40 |    0.3% |      2.50 | `std+functional (g++-10 c++17 Debug)`
|    18.8% |              231.69 |                4.32 |    0.1% |      2.55 | `std+algorithm (g++-10 c++17 Debug)`
|    15.8% |              276.66 |                3.61 |    0.1% |      3.05 | `std+all (g++-10 c++17 Debug)`
|    98.4% |               44.27 |               22.59 |    0.4% |      0.49 | `baseline (g++-10 c++20 Debug)`
|    32.8% |              132.66 |                7.54 |    0.2% |      1.46 | `std (g++-10 c++20 Debug)`
|    21.0% |              207.40 |                4.82 |    0.1% |      2.28 | `std+vector (g++-10 c++20 Debug)`
|    25.2% |              172.72 |                5.79 |    0.2% |      1.90 | `std+deque (g++-10 c++20 Debug)`
|     7.6% |              576.89 |                1.73 |    0.2% |      6.34 | `std+memory (g++-10 c++20 Debug)`
|    10.9% |              400.67 |                2.50 |    0.2% |      4.41 | `std+iterator (g++-10 c++20 Debug)`
|    14.8% |              294.43 |                3.40 |    0.1% |      3.24 | `std+functional (g++-10 c++20 Debug)`
|     6.7% |              646.57 |                1.55 |    0.2% |      7.13 | `std+algorithm (g++-10 c++20 Debug)`
|     6.0% |              731.61 |                1.37 |    0.1% |      8.05 | `std+all (g++-10 c++20 Debug)`
|    97.8% |               44.54 |               22.45 |    0.3% |      0.49 | `baseline (g++-10 c++17 Release)`
|    44.7% |               97.40 |               10.27 |    0.1% |      1.07 | `std (g++-10 c++17 Release)`
|    35.2% |              123.63 |                8.09 |    0.1% |      1.36 | `std+vector (g++-10 c++17 Release)`
|    37.5% |              116.14 |                8.61 |    0.3% |      1.28 | `std+deque (g++-10 c++17 Release)`
|    27.7% |              157.21 |                6.36 |    0.2% |      1.73 | `std+memory (g++-10 c++17 Release)`
|    18.7% |              232.74 |                4.30 |    0.2% |      2.56 | `std+iterator (g++-10 c++17 Release)`
|    20.1% |              216.80 |                4.61 |    0.1% |      2.39 | `std+functional (g++-10 c++17 Release)`
|    19.7% |              221.10 |                4.52 |    0.1% |      2.43 | `std+algorithm (g++-10 c++17 Release)`
|    16.1% |              270.52 |                3.70 |    0.1% |      2.98 | `std+all (g++-10 c++17 Release)`
|    97.5% |               44.68 |               22.38 |    0.6% |      0.49 | `baseline (g++-10 c++20 Release)`
|    34.0% |              128.08 |                7.81 |    0.1% |      1.41 | `std (g++-10 c++20 Release)`
|    21.8% |              200.02 |                5.00 |    0.1% |      2.20 | `std+vector (g++-10 c++20 Release)`
|    25.8% |              168.85 |                5.92 |    0.2% |      1.86 | `std+deque (g++-10 c++20 Release)`
|     7.9% |              553.41 |                1.81 |    0.2% |      6.08 | `std+memory (g++-10 c++20 Release)`
|    11.4% |              381.60 |                2.62 |    0.1% |      4.20 | `std+iterator (g++-10 c++20 Release)`
|    15.6% |              280.08 |                3.57 |    0.1% |      3.08 | `std+functional (g++-10 c++20 Release)`
|     7.1% |              615.59 |                1.62 |    0.2% |      6.76 | `std+algorithm (g++-10 c++20 Release)`
|     6.2% |              697.98 |                1.43 |    0.2% |      7.68 | `std+all (g++-10 c++20 Release)`
|    98.5% |               44.26 |               22.60 |    0.3% |      0.49 | `baseline (g++-11 c++17 Debug)`
|    44.0% |               99.09 |               10.09 |    0.3% |      1.09 | `std (g++-11 c++17 Debug)`
|    34.5% |              126.27 |                7.92 |    0.2% |      1.39 | `std+vector (g++-11 c++17 Debug)`
|    36.7% |              118.83 |                8.42 |    0.1% |      1.31 | `std+deque (g++-11 c++17 Debug)`
|    26.8% |              162.37 |                6.16 |    0.1% |      1.79 | `std+memory (g++-11 c++17 Debug)`
|    18.2% |              239.10 |                4.18 |    0.1% |      2.63 | `std+iterator (g++-11 c++17 Debug)`
|    19.8% |              220.28 |                4.54 |    0.1% |      2.42 | `std+functional (g++-11 c++17 Debug)`
|    19.4% |              225.10 |                4.44 |    0.2% |      2.48 | `std+algorithm (g++-11 c++17 Debug)`
|    15.7% |              276.74 |                3.61 |    0.1% |      3.04 | `std+all (g++-11 c++17 Debug)`
|    97.5% |               44.67 |               22.39 |    0.7% |      0.49 | `baseline (g++-11 c++20 Debug)`
|    34.9% |              124.74 |                8.02 |    0.2% |      1.37 | `std (g++-11 c++20 Debug)`
|    22.3% |              194.97 |                5.13 |    0.1% |      2.14 | `std+vector (g++-11 c++20 Debug)`
|    26.4% |              164.75 |                6.07 |    0.3% |      1.81 | `std+deque (g++-11 c++20 Debug)`
|    10.2% |              427.28 |                2.34 |    0.1% |      4.70 | `std+memory (g++-11 c++20 Debug)`
|    13.1% |              333.65 |                3.00 |    0.1% |      3.67 | `std+iterator (g++-11 c++20 Debug)`
|    15.9% |              274.56 |                3.64 |    0.2% |      3.02 | `std+functional (g++-11 c++20 Debug)`
|     8.9% |              489.57 |                2.04 |    0.1% |      5.39 | `std+algorithm (g++-11 c++20 Debug)`
|     7.4% |              585.92 |                1.71 |    0.1% |      6.44 | `std+all (g++-11 c++20 Debug)`
|    97.5% |               44.71 |               22.36 |    0.3% |      0.49 | `baseline (g++-11 c++17 Release)`
|    45.5% |               95.78 |               10.44 |    0.3% |      1.05 | `std (g++-11 c++17 Release)`
|    35.7% |              122.13 |                8.19 |    0.2% |      1.34 | `std+vector (g++-11 c++17 Release)`
|    37.9% |              114.96 |                8.70 |    0.1% |      1.26 | `std+deque (g++-11 c++17 Release)`
|    26.9% |              162.26 |                6.16 |    0.1% |      1.79 | `std+memory (g++-11 c++17 Release)`
|    18.6% |              233.81 |                4.28 |    0.2% |      2.57 | `std+iterator (g++-11 c++17 Release)`
|    20.6% |              211.35 |                4.73 |    0.1% |      2.32 | `std+functional (g++-11 c++17 Release)`
|    20.2% |              215.53 |                4.64 |    0.1% |      2.37 | `std+algorithm (g++-11 c++17 Release)`
|    16.1% |              271.09 |                3.69 |    0.1% |      2.98 | `std+all (g++-11 c++17 Release)`
|    96.8% |               45.00 |               22.22 |    0.7% |      0.50 | `baseline (g++-11 c++20 Release)`
|    36.2% |              120.27 |                8.31 |    0.1% |      1.32 | `std (g++-11 c++20 Release)`
|    23.1% |              188.68 |                5.30 |    0.1% |      2.08 | `std+vector (g++-11 c++20 Release)`
|    26.9% |              161.81 |                6.18 |    0.1% |      1.78 | `std+deque (g++-11 c++20 Release)`
|    10.3% |              422.64 |                2.37 |    0.2% |      4.65 | `std+memory (g++-11 c++20 Release)`
|    13.5% |              323.79 |                3.09 |    0.1% |      3.57 | `std+iterator (g++-11 c++20 Release)`
|    16.7% |              260.46 |                3.84 |    0.1% |      2.86 | `std+functional (g++-11 c++20 Release)`
|     9.3% |              467.61 |                2.14 |    0.1% |      5.14 | `std+algorithm (g++-11 c++20 Release)`
|     7.6% |              570.24 |                1.75 |    0.1% |      6.28 | `std+all (g++-11 c++20 Release)`
|    91.1% |               47.85 |               20.90 |    0.5% |      0.53 | `baseline (g++-12 c++17 Debug)`
|    38.3% |              113.90 |                8.78 |    0.2% |      1.25 | `std (g++-12 c++17 Debug)`
|    27.9% |              156.17 |                6.40 |    0.2% |      1.72 | `std+vector (g++-12 c++17 Debug)`
|    29.6% |              147.27 |                6.79 |    0.1% |      1.62 | `std+deque (g++-12 c++17 Debug)`
|    22.9% |              189.91 |                5.27 |    0.1% |      2.09 | `std+memory (g++-12 c++17 Debug)`
|    15.8% |              275.97 |                3.62 |    0.0% |      3.04 | `std+iterator (g++-12 c++17 Debug)`
|    17.3% |              251.89 |                3.97 |    0.1% |      2.77 | `std+functional (g++-12 c++17 Debug)`
|    30.9% |              141.24 |                7.08 |    0.3% |      1.56 | `std+algorithm (g++-12 c++17 Debug)`
|    13.7% |              319.17 |                3.13 |    0.1% |      3.51 | `std+all (g++-12 c++17 Debug)`
|    91.3% |               47.75 |               20.94 |    0.2% |      0.52 | `baseline (g++-12 c++20 Debug)`
|    30.5% |              142.86 |                7.00 |    0.2% |      1.57 | `std (g++-12 c++20 Debug)`
|    20.9% |              208.84 |                4.79 |    0.1% |      2.30 | `std+vector (g++-12 c++20 Debug)`
|    24.9% |              174.95 |                5.72 |    0.2% |      1.93 | `std+deque (g++-12 c++20 Debug)`
|     9.3% |              470.61 |                2.12 |    0.1% |      5.18 | `std+memory (g++-12 c++20 Debug)`
|    12.1% |              359.98 |                2.78 |    0.1% |      3.96 | `std+iterator (g++-12 c++20 Debug)`
|    14.1% |              310.04 |                3.23 |    0.1% |      3.41 | `std+functional (g++-12 c++20 Debug)`
|    19.2% |              227.34 |                4.40 |    0.3% |      2.50 | `std+algorithm (g++-12 c++20 Debug)`
|     6.6% |              664.03 |                1.51 |    0.0% |      7.31 | `std+all (g++-12 c++20 Debug)`
|    91.0% |               47.90 |               20.88 |    0.3% |      0.53 | `baseline (g++-12 c++17 Release)`
|    39.8% |              109.41 |                9.14 |    0.1% |      1.20 | `std (g++-12 c++17 Release)`
|    28.9% |              150.66 |                6.64 |    0.1% |      1.66 | `std+vector (g++-12 c++17 Release)`
|    30.6% |              142.17 |                7.03 |    0.1% |      1.56 | `std+deque (g++-12 c++17 Release)`
|    23.0% |              189.07 |                5.29 |    0.2% |      2.08 | `std+memory (g++-12 c++17 Release)`
|    16.2% |              268.85 |                3.72 |    0.1% |      2.96 | `std+iterator (g++-12 c++17 Release)`
|    18.1% |              241.29 |                4.14 |    0.1% |      2.65 | `std+functional (g++-12 c++17 Release)`
|    31.6% |              138.06 |                7.24 |    0.4% |      1.52 | `std+algorithm (g++-12 c++17 Release)`
|    13.9% |              313.73 |                3.19 |    0.2% |      3.45 | `std+all (g++-12 c++17 Release)`
|    90.8% |               47.99 |               20.84 |    0.3% |      0.53 | `baseline (g++-12 c++20 Release)`
|    31.8% |              137.05 |                7.30 |    0.2% |      1.51 | `std (g++-12 c++20 Release)`
|    21.9% |              198.60 |                5.04 |    0.1% |      2.19 | `std+vector (g++-12 c++20 Release)`
|    25.8% |              168.93 |                5.92 |    0.1% |      1.86 | `std+deque (g++-12 c++20 Release)`
|     9.4% |              465.56 |                2.15 |    0.2% |      5.12 | `std+memory (g++-12 c++20 Release)`
|    12.5% |              347.66 |                2.88 |    0.1% |      3.83 | `std+iterator (g++-12 c++20 Release)`
|    14.8% |              294.85 |                3.39 |    0.1% |      3.24 | `std+functional (g++-12 c++20 Release)`
|    19.7% |              221.23 |                4.52 |    0.1% |      2.43 | `std+algorithm (g++-12 c++20 Release)`
|     6.7% |              645.96 |                1.55 |    0.2% |      7.13 | `std+all (g++-12 c++20 Release)`
|    47.8% |               91.08 |               10.98 |    0.3% |      1.00 | `baseline (clang++-11 c++17 libstdc++ Debug)`
|    28.7% |              151.62 |                6.60 |    0.3% |      1.67 | `std (clang++-11 c++17 libstdc++ Debug)`
|    23.0% |              189.64 |                5.27 |    0.2% |      2.08 | `std+vector (clang++-11 c++17 libstdc++ Debug)`
|    24.3% |              179.11 |                5.58 |    0.2% |      1.99 | `std+deque (clang++-11 c++17 libstdc++ Debug)`
|    19.9% |              218.47 |                4.58 |    0.2% |      2.41 | `std+memory (clang++-11 c++17 libstdc++ Debug)`
|    15.9% |              274.84 |                3.64 |    0.2% |      3.03 | `std+iterator (clang++-11 c++17 libstdc++ Debug)`
|    16.8% |              259.53 |                3.85 |    0.2% |      2.86 | `std+functional (clang++-11 c++17 libstdc++ Debug)`
|    24.7% |              176.10 |                5.68 |    0.2% |      1.94 | `std+algorithm (clang++-11 c++17 libstdc++ Debug)`
|    13.7% |              319.10 |                3.13 |    0.1% |      3.51 | `std+all (clang++-11 c++17 libstdc++ Debug)`
|    47.7% |               91.31 |               10.95 |    0.2% |      1.00 | `baseline (clang++-11 c++20 libstdc++ Debug)`
|    24.7% |              176.66 |                5.66 |    0.4% |      1.94 | `std (clang++-11 c++20 libstdc++ Debug)`
|    18.2% |              239.89 |                4.17 |    0.1% |      2.64 | `std+vector (clang++-11 c++20 libstdc++ Debug)`
|    21.4% |              203.71 |                4.91 |    0.2% |      2.24 | `std+deque (clang++-11 c++20 libstdc++ Debug)`
|     9.2% |              471.99 |                2.12 |    0.1% |      5.19 | `std+memory (clang++-11 c++20 libstdc++ Debug)`
|    11.8% |              370.77 |                2.70 |    0.1% |      4.08 | `std+iterator (clang++-11 c++20 libstdc++ Debug)`
|    13.9% |              314.07 |                3.18 |    0.1% |      3.46 | `std+functional (clang++-11 c++20 libstdc++ Debug)`
|    17.6% |              247.84 |                4.03 |    0.1% |      2.73 | `std+algorithm (clang++-11 c++20 libstdc++ Debug)`
|     7.0% |              623.88 |                1.60 |    0.1% |      6.86 | `std+all (clang++-11 c++20 libstdc++ Debug)`
|    46.2% |               94.22 |               10.61 |    0.6% |      1.04 | `baseline (clang++-11 c++17 libstdc++ Release)`
|    28.2% |              154.55 |                6.47 |    0.1% |      1.70 | `std (clang++-11 c++17 libstdc++ Release)`
|    22.7% |              192.14 |                5.20 |    0.3% |      2.11 | `std+vector (clang++-11 c++17 libstdc++ Release)`
|    23.9% |              182.29 |                5.49 |    0.2% |      2.01 | `std+deque (clang++-11 c++17 libstdc++ Release)`
|    19.7% |              221.51 |                4.51 |    0.3% |      2.43 | `std+memory (clang++-11 c++17 libstdc++ Release)`
|    15.7% |              276.78 |                3.61 |    0.2% |      3.05 | `std+iterator (clang++-11 c++17 libstdc++ Release)`
|    16.6% |              263.21 |                3.80 |    0.3% |      2.89 | `std+functional (clang++-11 c++17 libstdc++ Release)`
|    24.3% |              179.06 |                5.58 |    0.1% |      1.98 | `std+algorithm (clang++-11 c++17 libstdc++ Release)`
|    13.6% |              321.53 |                3.11 |    0.1% |      3.54 | `std+all (clang++-11 c++17 libstdc++ Release)`
|    46.2% |               94.26 |               10.61 |    0.3% |      1.04 | `baseline (clang++-11 c++20 libstdc++ Release)`
|    24.2% |              179.80 |                5.56 |    0.2% |      1.98 | `std (clang++-11 c++20 libstdc++ Release)`
|    18.0% |              242.70 |                4.12 |    0.2% |      2.67 | `std+vector (clang++-11 c++20 libstdc++ Release)`
|    21.0% |              207.30 |                4.82 |    0.1% |      2.28 | `std+deque (clang++-11 c++20 libstdc++ Release)`
|     9.2% |              474.97 |                2.11 |    0.1% |      5.22 | `std+memory (clang++-11 c++20 libstdc++ Release)`
|    11.7% |              372.50 |                2.68 |    0.2% |      4.11 | `std+iterator (clang++-11 c++20 libstdc++ Release)`
|    13.7% |              317.61 |                3.15 |    0.2% |      3.49 | `std+functional (clang++-11 c++20 libstdc++ Release)`
|    17.3% |              251.47 |                3.98 |    0.2% |      2.77 | `std+algorithm (clang++-11 c++20 libstdc++ Release)`
|     6.9% |              627.82 |                1.59 |    0.2% |      6.91 | `std+all (clang++-11 c++20 libstdc++ Release)`
|    46.5% |               93.68 |               10.68 |    0.6% |      1.03 | `baseline (clang++-12 c++17 libstdc++ Debug)`
|    28.1% |              154.99 |                6.45 |    0.3% |      1.70 | `std (clang++-12 c++17 libstdc++ Debug)`
|    22.5% |              193.48 |                5.17 |    0.3% |      2.13 | `std+vector (clang++-12 c++17 libstdc++ Debug)`
|    23.7% |              183.55 |                5.45 |    0.2% |      2.02 | `std+deque (clang++-12 c++17 libstdc++ Debug)`
|    19.4% |              224.45 |                4.46 |    0.1% |      2.47 | `std+memory (clang++-12 c++17 libstdc++ Debug)`
|    15.4% |              282.27 |                3.54 |    0.2% |      3.10 | `std+iterator (clang++-12 c++17 libstdc++ Debug)`
|    16.4% |              266.28 |                3.76 |    0.2% |      2.93 | `std+functional (clang++-12 c++17 libstdc++ Debug)`
|    24.1% |              180.50 |                5.54 |    0.2% |      1.99 | `std+algorithm (clang++-12 c++17 libstdc++ Debug)`
|    13.3% |              326.78 |                3.06 |    0.3% |      3.59 | `std+all (clang++-12 c++17 libstdc++ Debug)`
|    46.4% |               93.83 |               10.66 |    0.4% |      1.03 | `baseline (clang++-12 c++20 libstdc++ Debug)`
|    24.2% |              180.17 |                5.55 |    0.1% |      1.98 | `std (clang++-12 c++20 libstdc++ Debug)`
|    17.8% |              244.76 |                4.09 |    0.2% |      2.69 | `std+vector (clang++-12 c++20 libstdc++ Debug)`
|    20.9% |              208.80 |                4.79 |    0.2% |      2.29 | `std+deque (clang++-12 c++20 libstdc++ Debug)`
|     9.0% |              484.93 |                2.06 |    0.1% |      5.33 | `std+memory (clang++-12 c++20 libstdc++ Debug)`
|    11.4% |              381.64 |                2.62 |    0.1% |      4.20 | `std+iterator (clang++-12 c++20 libstdc++ Debug)`
|    13.6% |              321.43 |                3.11 |    0.2% |      3.53 | `std+functional (clang++-12 c++20 libstdc++ Debug)`
|    17.2% |              253.90 |                3.94 |    0.2% |      2.79 | `std+algorithm (clang++-12 c++20 libstdc++ Debug)`
|     6.8% |              641.71 |                1.56 |    0.2% |      7.06 | `std+all (clang++-12 c++20 libstdc++ Debug)`
|    45.4% |               96.01 |               10.42 |    0.4% |      1.06 | `baseline (clang++-12 c++17 libstdc++ Release)`
|    27.8% |              156.64 |                6.38 |    0.2% |      1.73 | `std (clang++-12 c++17 libstdc++ Release)`
|    22.2% |              195.88 |                5.11 |    0.3% |      2.15 | `std+vector (clang++-12 c++17 libstdc++ Release)`
|    23.5% |              185.53 |                5.39 |    0.4% |      2.05 | `std+deque (clang++-12 c++17 libstdc++ Release)`
|    19.3% |              225.98 |                4.43 |    0.0% |      2.48 | `std+memory (clang++-12 c++17 libstdc++ Release)`
|    15.4% |              283.29 |                3.53 |    0.2% |      3.11 | `std+iterator (clang++-12 c++17 libstdc++ Release)`
|    16.2% |              268.38 |                3.73 |    0.1% |      2.95 | `std+functional (clang++-12 c++17 libstdc++ Release)`
|    23.9% |              182.57 |                5.48 |    0.1% |      2.01 | `std+algorithm (clang++-12 c++17 libstdc++ Release)`
|    13.3% |              328.04 |                3.05 |    0.2% |      3.61 | `std+all (clang++-12 c++17 libstdc++ Release)`
|    45.2% |               96.30 |               10.38 |    0.4% |      1.06 | `baseline (clang++-12 c++20 libstdc++ Release)`
|    23.8% |              183.24 |                5.46 |    0.1% |      2.01 | `std (clang++-12 c++20 libstdc++ Release)`
|    17.6% |              247.48 |                4.04 |    0.2% |      2.72 | `std+vector (clang++-12 c++20 libstdc++ Release)`
|    20.7% |              210.90 |                4.74 |    0.2% |      2.32 | `std+deque (clang++-12 c++20 libstdc++ Release)`
|     8.9% |              488.94 |                2.05 |    0.2% |      5.37 | `std+memory (clang++-12 c++20 libstdc++ Release)`
|    11.3% |              386.14 |                2.59 |    0.4% |      4.25 | `std+iterator (clang++-12 c++20 libstdc++ Release)`
|    13.5% |              323.84 |                3.09 |    0.2% |      3.57 | `std+functional (clang++-12 c++20 libstdc++ Release)`
|    17.0% |              256.75 |                3.89 |    0.3% |      2.83 | `std+algorithm (clang++-12 c++20 libstdc++ Release)`
|     6.7% |              654.98 |                1.53 |    1.5% |      7.30 | `std+all (clang++-12 c++20 libstdc++ Release)`
|    44.2% |               98.65 |               10.14 |    2.0% |      1.09 | `baseline (clang++-13 c++17 libstdc++ Debug)`
|    27.4% |              158.90 |                6.29 |    0.6% |      1.76 | `std (clang++-13 c++17 libstdc++ Debug)`
|    21.9% |              199.00 |                5.03 |    0.2% |      2.20 | `std+vector (clang++-13 c++17 libstdc++ Debug)`
|    23.1% |              188.25 |                5.31 |    0.5% |      2.07 | `std+deque (clang++-13 c++17 libstdc++ Debug)`
|    19.0% |              229.29 |                4.36 |    0.5% |      2.53 | `std+memory (clang++-13 c++17 libstdc++ Debug)`
|    15.0% |              289.90 |                3.45 |    0.3% |      3.19 | `std+iterator (clang++-13 c++17 libstdc++ Debug)`
|    16.0% |              272.82 |                3.67 |    0.3% |      3.02 | `std+functional (clang++-13 c++17 libstdc++ Debug)`
|    23.5% |              185.28 |                5.40 |    0.3% |      2.04 | `std+algorithm (clang++-13 c++17 libstdc++ Debug)`
|    13.0% |              335.01 |                2.98 |    0.4% |      3.73 | `std+all (clang++-13 c++17 libstdc++ Debug)`
|    44.4% |               98.15 |               10.19 |    0.9% |      1.08 | `baseline (clang++-13 c++20 libstdc++ Debug)`
|    23.5% |              185.75 |                5.38 |    0.4% |      2.05 | `std (clang++-13 c++20 libstdc++ Debug)`
|    17.1% |              254.63 |                3.93 |    0.9% |      2.81 | `std+vector (clang++-13 c++20 libstdc++ Debug)`
|    20.4% |              214.00 |                4.67 |    0.3% |      2.36 | `std+deque (clang++-13 c++20 libstdc++ Debug)`
|     8.8% |              497.03 |                2.01 |    0.2% |      5.48 | `std+memory (clang++-13 c++20 libstdc++ Debug)`
|    11.1% |              393.64 |                2.54 |    0.8% |      4.34 | `std+iterator (clang++-13 c++20 libstdc++ Debug)`
|    13.3% |              328.36 |                3.05 |    0.2% |      3.61 | `std+functional (clang++-13 c++20 libstdc++ Debug)`
|    16.8% |              259.97 |                3.85 |    0.2% |      2.86 | `std+algorithm (clang++-13 c++20 libstdc++ Debug)`
|     6.6% |              655.51 |                1.53 |    0.4% |      7.22 | `std+all (clang++-13 c++20 libstdc++ Debug)`
|    43.9% |               99.19 |               10.08 |    0.6% |      1.09 | `baseline (clang++-13 c++17 libstdc++ Release)`
|    26.8% |              162.84 |                6.14 |    0.8% |      1.81 | `std (clang++-13 c++17 libstdc++ Release)`
|    21.6% |              201.33 |                4.97 |    1.0% |      2.25 | `std+vector (clang++-13 c++17 libstdc++ Release)`
|    23.0% |              189.14 |                5.29 |    0.4% |      2.10 | `std+deque (clang++-13 c++17 libstdc++ Release)`
|    19.0% |              229.83 |                4.35 |    0.3% |      2.53 | `std+memory (clang++-13 c++17 libstdc++ Release)`
|    15.0% |              290.67 |                3.44 |    0.4% |      3.20 | `std+iterator (clang++-13 c++17 libstdc++ Release)`
|    15.9% |              273.21 |                3.66 |    0.3% |      3.01 | `std+functional (clang++-13 c++17 libstdc++ Release)`
|    23.4% |              186.35 |                5.37 |    0.2% |      2.05 | `std+algorithm (clang++-13 c++17 libstdc++ Release)`
|    13.0% |              334.07 |                2.99 |    0.1% |      3.68 | `std+all (clang++-13 c++17 libstdc++ Release)`
|    43.8% |               99.53 |               10.05 |    0.4% |      1.09 | `baseline (clang++-13 c++20 libstdc++ Release)`
|    23.2% |              187.51 |                5.33 |    0.9% |      2.08 | `std (clang++-13 c++20 libstdc++ Release)`
|    17.3% |              252.10 |                3.97 |    0.2% |      2.78 | `std+vector (clang++-13 c++20 libstdc++ Release)`
|    20.3% |              214.99 |                4.65 |    0.2% |      2.38 | `std+deque (clang++-13 c++20 libstdc++ Release)`
|     8.8% |              497.75 |                2.01 |    0.4% |      5.51 | `std+memory (clang++-13 c++20 libstdc++ Release)`
|    11.1% |              391.42 |                2.55 |    0.2% |      4.31 | `std+iterator (clang++-13 c++20 libstdc++ Release)`
|    13.2% |              329.27 |                3.04 |    0.2% |      3.63 | `std+functional (clang++-13 c++20 libstdc++ Release)`
|    16.6% |              261.73 |                3.82 |    0.4% |      2.89 | `std+algorithm (clang++-13 c++20 libstdc++ Release)`
|     6.6% |              657.32 |                1.52 |    0.4% |      7.25 | `std+all (clang++-13 c++20 libstdc++ Release)`
|    43.7% |               99.80 |               10.02 |    0.4% |      1.10 | `baseline (clang++-14 c++17 libstdc++ Debug)`
|    26.7% |              163.14 |                6.13 |    0.1% |      1.80 | `std (clang++-14 c++17 libstdc++ Debug)`
|    21.5% |              202.67 |                4.93 |    0.2% |      2.23 | `std+vector (clang++-14 c++17 libstdc++ Debug)`
|    22.7% |              192.38 |                5.20 |    0.2% |      2.12 | `std+deque (clang++-14 c++17 libstdc++ Debug)`
|    18.5% |              234.95 |                4.26 |    0.6% |      2.61 | `std+memory (clang++-14 c++17 libstdc++ Debug)`
|    14.8% |              294.95 |                3.39 |    0.1% |      3.25 | `std+iterator (clang++-14 c++17 libstdc++ Debug)`
|    15.7% |              277.53 |                3.60 |    0.1% |      3.05 | `std+functional (clang++-14 c++17 libstdc++ Debug)`
|    23.0% |              189.20 |                5.29 |    0.6% |      2.08 | `std+algorithm (clang++-14 c++17 libstdc++ Debug)`
|    12.7% |              341.84 |                2.93 |    0.5% |      3.80 | `std+all (clang++-14 c++17 libstdc++ Debug)`
|    43.3% |              100.60 |                9.94 |    0.8% |      1.11 | `baseline (clang++-14 c++20 libstdc++ Debug)`
|    23.0% |              189.08 |                5.29 |    0.5% |      2.09 | `std (clang++-14 c++20 libstdc++ Debug)`
|    17.0% |              255.78 |                3.91 |    0.3% |      2.82 | `std+vector (clang++-14 c++20 libstdc++ Debug)`
|    19.7% |              220.68 |                4.53 |    0.9% |      2.44 | `std+deque (clang++-14 c++20 libstdc++ Debug)`
|     8.6% |              505.17 |                1.98 |    0.5% |      5.60 | `std+memory (clang++-14 c++20 libstdc++ Debug)`
|    11.0% |              397.13 |                2.52 |    0.2% |      4.39 | `std+iterator (clang++-14 c++20 libstdc++ Debug)`
|    13.0% |              334.25 |                2.99 |    0.4% |      3.70 | `std+functional (clang++-14 c++20 libstdc++ Debug)`
|    16.5% |              263.59 |                3.79 |    0.2% |      2.91 | `std+algorithm (clang++-14 c++20 libstdc++ Debug)`
|     6.5% |              675.05 |                1.48 |    1.4% |      7.41 | `std+all (clang++-14 c++20 libstdc++ Debug)`
|    57.0% |               76.46 |               13.08 |    1.0% |      0.84 | `baseline (clang++-14 c++17 libc++ Debug)`
|    12.0% |              364.00 |                2.75 |    1.1% |      4.05 | `std (clang++-14 c++17 libc++ Debug)`
|    11.3% |              386.47 |                2.59 |    0.7% |      4.27 | `std+vector (clang++-14 c++17 libc++ Debug)`
|    11.3% |              384.78 |                2.60 |    1.4% |      4.24 | `std+deque (clang++-14 c++17 libc++ Debug)`
|    12.1% |              361.13 |                2.77 |    0.3% |      3.99 | `std+memory (clang++-14 c++17 libc++ Debug)`
|    12.1% |              360.57 |                2.77 |    0.3% |      3.99 | `std+iterator (clang++-14 c++17 libc++ Debug)`
|    12.1% |              360.01 |                2.78 |    0.2% |      3.97 | `std+functional (clang++-14 c++17 libc++ Debug)`
|    12.1% |              359.95 |                2.78 |    0.1% |      3.96 | `std+algorithm (clang++-14 c++17 libc++ Debug)`
|    10.9% |              400.72 |                2.50 |    0.1% |      4.41 | `std+all (clang++-14 c++17 libc++ Debug)`
|    59.2% |               73.62 |               13.58 |    0.9% |      0.81 | `baseline (clang++-14 c++20 libc++ Debug)`
|     9.5% |              459.98 |                2.17 |    0.1% |      5.06 | `std (clang++-14 c++20 libc++ Debug)`
|     8.9% |              487.46 |                2.05 |    0.2% |      5.38 | `std+vector (clang++-14 c++20 libc++ Debug)`
|     9.1% |              480.55 |                2.08 |    0.4% |      5.30 | `std+deque (clang++-14 c++20 libc++ Debug)`
|     9.5% |              460.47 |                2.17 |    0.4% |      5.08 | `std+memory (clang++-14 c++20 libc++ Debug)`
|     9.4% |              462.81 |                2.16 |    0.7% |      5.12 | `std+iterator (clang++-14 c++20 libc++ Debug)`
|     9.5% |              460.61 |                2.17 |    0.5% |      5.11 | `std+functional (clang++-14 c++20 libc++ Debug)`
|     9.5% |              460.18 |                2.17 |    0.1% |      5.10 | `std+algorithm (clang++-14 c++20 libc++ Debug)`
|     8.6% |              504.17 |                1.98 |    0.1% |      5.55 | `std+all (clang++-14 c++20 libc++ Debug)`
|    43.1% |              101.10 |                9.89 |    0.4% |      1.11 | `baseline (clang++-14 c++17 libstdc++ Release)`
|    26.6% |              163.85 |                6.10 |    0.2% |      1.80 | `std (clang++-14 c++17 libstdc++ Release)`
|    21.5% |              203.09 |                4.92 |    0.4% |      2.24 | `std+vector (clang++-14 c++17 libstdc++ Release)`
|    22.6% |              193.01 |                5.18 |    0.3% |      2.13 | `std+deque (clang++-14 c++17 libstdc++ Release)`
|    18.4% |              236.94 |                4.22 |    1.3% |      2.63 | `std+memory (clang++-14 c++17 libstdc++ Release)`
|    14.7% |              297.20 |                3.36 |    1.0% |      3.30 | `std+iterator (clang++-14 c++17 libstdc++ Release)`
|    15.2% |              285.87 |                3.50 |    1.0% |      3.18 | `std+functional (clang++-14 c++17 libstdc++ Release)`
|    22.3% |              194.97 |                5.13 |    1.5% |      2.14 | `std+algorithm (clang++-14 c++17 libstdc++ Release)`
|    12.7% |              342.65 |                2.92 |    0.9% |      3.77 | `std+all (clang++-14 c++17 libstdc++ Release)`
|    43.4% |              100.33 |                9.97 |    0.5% |      1.12 | `baseline (clang++-14 c++20 libstdc++ Release)`
|    23.2% |              188.21 |                5.31 |    0.3% |      2.07 | `std (clang++-14 c++20 libstdc++ Release)`
|    16.9% |              257.41 |                3.88 |    1.1% |      2.84 | `std+vector (clang++-14 c++20 libstdc++ Release)`
|    20.0% |              217.93 |                4.59 |    0.5% |      2.40 | `std+deque (clang++-14 c++20 libstdc++ Release)`
|     8.7% |              501.88 |                1.99 |    0.3% |      5.52 | `std+memory (clang++-14 c++20 libstdc++ Release)`
|    11.1% |              392.64 |                2.55 |    0.1% |      4.33 | `std+iterator (clang++-14 c++20 libstdc++ Release)`
|    13.1% |              331.83 |                3.01 |    0.1% |      3.66 | `std+functional (clang++-14 c++20 libstdc++ Release)`
|    16.5% |              263.63 |                3.79 |    0.4% |      2.92 | `std+algorithm (clang++-14 c++20 libstdc++ Release)`
|     6.6% |              663.70 |                1.51 |    0.3% |      7.29 | `std+all (clang++-14 c++20 libstdc++ Release)`
|    58.5% |               74.45 |               13.43 |    0.5% |      0.82 | `baseline (clang++-14 c++17 libc++ Release)`
|    12.2% |              357.39 |                2.80 |    0.3% |      3.94 | `std (clang++-14 c++17 libc++ Release)`
|    11.4% |              383.46 |                2.61 |    0.2% |      4.22 | `std+vector (clang++-14 c++17 libc++ Release)`
|    11.6% |              376.19 |                2.66 |    0.2% |      4.14 | `std+deque (clang++-14 c++17 libc++ Release)`
|    12.2% |              357.45 |                2.80 |    0.4% |      3.94 | `std+memory (clang++-14 c++17 libc++ Release)`
|    12.2% |              357.65 |                2.80 |    0.4% |      3.94 | `std+iterator (clang++-14 c++17 libc++ Release)`
|    12.2% |              357.41 |                2.80 |    0.1% |      3.93 | `std+functional (clang++-14 c++17 libc++ Release)`
|    12.2% |              356.42 |                2.81 |    0.3% |      3.93 | `std+algorithm (clang++-14 c++17 libc++ Release)`
|    10.9% |              398.36 |                2.51 |    0.2% |      4.39 | `std+all (clang++-14 c++17 libc++ Release)`
|    58.5% |               74.48 |               13.43 |    0.7% |      0.82 | `baseline (clang++-14 c++20 libc++ Release)`
|     9.6% |              456.11 |                2.19 |    0.4% |      5.02 | `std (clang++-14 c++20 libc++ Release)`
|     9.0% |              483.34 |                2.07 |    0.3% |      5.32 | `std+vector (clang++-14 c++20 libc++ Release)`
|     9.1% |              476.89 |                2.10 |    0.2% |      5.25 | `std+deque (clang++-14 c++20 libc++ Release)`
|     9.6% |              456.17 |                2.19 |    0.2% |      5.02 | `std+memory (clang++-14 c++20 libc++ Release)`
|     9.5% |              456.86 |                2.19 |    0.1% |      5.03 | `std+iterator (clang++-14 c++20 libc++ Release)`
|     9.5% |              456.67 |                2.19 |    0.3% |      5.02 | `std+functional (clang++-14 c++20 libc++ Release)`
|     9.5% |              459.59 |                2.18 |    0.4% |      5.06 | `std+algorithm (clang++-14 c++20 libc++ Release)`
|     8.7% |              502.37 |                1.99 |    0.4% |      5.53 | `std+all (clang++-14 c++20 libc++ Release)`
YarikTH commented 1 year ago

Impact of using <algorithm> replacement

ureact headers include time |   |   -- | -- | -- `events (g++-9 c++17 Debug) std algorithm` | 431.46 | 20.73% `events (g++-9 c++2a Debug) std algorithm` | 452.12 | 17.42% `events (g++-9 c++17 Release) std algorithm` | 390.38 | 21.04% `events (g++-9 c++2a Release) std algorithm` | 405.94 | 17.67% `events (g++-10 c++17 Debug) std algorithm` | 364.16 | 25.40% `events (g++-10 c++20 Debug) std algorithm` | 827.5 | 12.54% `events (g++-10 c++17 Release) std algorithm` | 348.43 | 25.36% `events (g++-10 c++20 Release) std algorithm` | 786.07 | 12.32% `events (g++-11 c++17 Debug) std algorithm` | 354.76 | 24.63% `events (g++-11 c++20 Debug) std algorithm` | 671.62 | 15.65% `events (g++-11 c++17 Release) std algorithm` | 340.27 | 24.10% `events (g++-11 c++20 Release) std algorithm` | 648.49 | 15.59% `events (g++-12 c++17 Debug) std algorithm` | 328.92 | 7.70% `events (g++-12 c++20 Debug) std algorithm` | 678.35 | 8.59% `events (g++-12 c++17 Release) std algorithm` | 319.93 | 8.56% `events (g++-12 c++20 Release) std algorithm` | 653.86 | 8.37% `events (clang++-11 c++17 libstdc++ Debug) std algorithm` | 336.75 | 7.07% `events (clang++-11 c++20 libstdc++ Debug) std algorithm` | 671.25 | 9.89% `events (clang++-11 c++17 libstdc++ Release) std algorithm` | 340.39 | 6.70% `events (clang++-11 c++20 libstdc++ Release) std algorithm` | 658.68 | 8.09% `events (clang++-12 c++17 libstdc++ Debug) std algorithm` | 346.46 | 7.05% `events (clang++-12 c++20 libstdc++ Debug) std algorithm` | 667.43 | 7.11% `events (clang++-12 c++17 libstdc++ Release) std algorithm` | 347.56 | 6.91% `events (clang++-12 c++20 libstdc++ Release) std algorithm` | 667.75 | 6.77% `events (clang++-13 c++17 libstdc++ Debug) std algorithm` | 351.66 | 6.92% `events (clang++-13 c++20 libstdc++ Debug) std algorithm` | 678.57 | 6.35% `events (clang++-13 c++17 libstdc++ Release) std algorithm` | 355.55 | 7.15% `events (clang++-13 c++20 libstdc++ Release) std algorithm` | 683.67 | 6.81% `events (clang++-14 c++17 libstdc++ Debug) std algorithm` | 360.63 | 6.82% `events (clang++-14 c++20 libstdc++ Debug) std algorithm` | 686.28 | 7.16% `events (clang++-14 c++17 libc++ Debug) std algorithm` | 453.32 | 0.07% `events (clang++-14 c++20 libc++ Debug) std algorithm` | 556.77 | -0.05% `events (clang++-14 c++17 libstdc++ Release) std algorithm` | 357.32 | 7.05% `events (clang++-14 c++20 libstdc++ Release) std algorithm` | 684.35 | 6.97% `events (clang++-14 c++17 libc++ Release) std algorithm` | 453.2 | -0.29% `events (clang++-14 c++20 libc++ Release) std algorithm` | 555.86 | -0.10%

Fun fact: difference decreaces to almost zero if we include <functional>

ureact headers include time |   |   -- | -- | -- `signal (g++-9 c++17 Debug) std algorithm` | 431.19 | 1.00% `signal (g++-9 c++2a Debug) std algorithm` | 452.9 | 1.14% `signal (g++-9 c++17 Release) std algorithm` | 393.15 | 1.55% `signal (g++-9 c++2a Release) std algorithm` | 407.84 | 1.10% `signal (g++-10 c++17 Debug) std algorithm` | 368.14 | 1.97% `signal (g++-10 c++20 Debug) std algorithm` | 828.12 | 3.72% `signal (g++-10 c++17 Release) std algorithm` | 349.36 | 1.83% `signal (g++-10 c++20 Release) std algorithm` | 788.07 | 4.03% `signal (g++-11 c++17 Debug) std algorithm` | 356.21 | 1.85% `signal (g++-11 c++20 Debug) std algorithm` | 675.95 | 5.34% `signal (g++-11 c++17 Release) std algorithm` | 341.34 | 1.24% `signal (g++-11 c++20 Release) std algorithm` | 648.97 | 5.48% `signal (g++-12 c++17 Debug) std algorithm` | 404.77 | 1.72% `signal (g++-12 c++20 Debug) std algorithm` | 760.64 | 5.66% `signal (g++-12 c++17 Release) std algorithm` | 389.22 | 1.49% `signal (g++-12 c++20 Release) std algorithm` | 735.56 | 5.96% `signal (clang++-11 c++17 libstdc++ Debug) std algorithm` | 388.83 | 0.37% `signal (clang++-11 c++20 libstdc++ Debug) std algorithm` | 708.28 | 4.04% `signal (clang++-11 c++17 libstdc++ Release) std algorithm` | 393.29 | 1.65% `signal (clang++-11 c++20 libstdc++ Release) std algorithm` | 707.88 | 4.28% `signal (clang++-12 c++17 libstdc++ Debug) std algorithm` | 400.94 | 1.89% `signal (clang++-12 c++20 libstdc++ Debug) std algorithm` | 725.07 | 4.61% `signal (clang++-12 c++17 libstdc++ Release) std algorithm` | 402.35 | 1.21% `signal (clang++-12 c++20 libstdc++ Release) std algorithm` | 723.98 | 4.29% `signal (clang++-13 c++17 libstdc++ Debug) std algorithm` | 405.54 | 1.15% `signal (clang++-13 c++20 libstdc++ Debug) std algorithm` | 741.46 | 3.85% `signal (clang++-13 c++17 libstdc++ Release) std algorithm` | 410.49 | 1.38% `signal (clang++-13 c++20 libstdc++ Release) std algorithm` | 743.11 | 4.64% `signal (clang++-14 c++17 libstdc++ Debug) std algorithm` | 415.88 | 1.33% `signal (clang++-14 c++20 libstdc++ Debug) std algorithm` | 744.18 | 4.31% `signal (clang++-14 c++17 libc++ Debug) std algorithm` | 454.65 | -0.19% `signal (clang++-14 c++20 libc++ Debug) std algorithm` | 557.85 | -0.13% `signal (clang++-14 c++17 libstdc++ Release) std algorithm` | 411.44 | 1.15% `signal (clang++-14 c++20 libstdc++ Release) std algorithm` | 742.81 | 4.30% `signal (clang++-14 c++17 libc++ Release) std algorithm` | 453.32 | -0.13% `signal (clang++-14 c++20 libc++ Release) std algorithm` | 556.57 | -0.16%

So it's better to avoid <functional> at least in ureact root includes and in ureact utils. Ureact adaptors are intended to be included only in cpp anyway.

YarikTH commented 1 year ago

There are several groups of use cases for library headers:

  1. Including ureact root headers
  2. Declaring ureact classes in headers (as part of public interface)
  3. Using adaptors inside cpp files

By including ureact root headers I mean that there is no forward declarations and ureact is intended to be included in headers. Thus if the fact of merely inclusion of ureact headers heavily impacts compilation times, it is bad. Headers tend to be accidentally recursively included in tons of cpp files, so each millisecond lost on inclusion stage is multiplied by amount of affected cpp files.
One way to improve it - making static library variant by hiding non-template code inside the library. But previous benchmarks didn't show significant difference.

By declaring ureact classes I mean actual usage by declaring public and private reactive fields of classes, declaring free functions receiving or/and returning reactive values. If each such template instantiation is slow, it affects several cpp too. Such usage should be comparable with using std::vector, std::shared_ptr and similar templated std classes.

And by the adaptor usage I mean the fact, that potentially class can require tens of adaptors. And if each receives it's unique lambda expression then it will lead to unique class instantiation. It should be relatively fast, otherwise relatively small usage of adaptors will lead to bloating of compilation times of the cpp where it is done.

YarikTH commented 1 year ago

<signal.hpp>

Extra include time: [70.1 ms - 116.4 ms] average - 89.4 ms Time in addition to time of inclusion of std headers. For example (g++-9 c++17 Debug):

Time to instantiate signal, var_signal with unique type: [0.87 ms - 4.06 ms] average - 2.45 ms.

Time to instantiate make_var and make_const with unique type: [10.15 ms - 21.15 ms] average - 14.71 ms. So, it is better to hide make_var and make_const into cpp files, to not to pay additional 15ms per unique instantiate per cpp.

YarikTH commented 1 year ago

<events.hpp>

Extra include time: [68.9 ms - 114.2 ms] average - 85.7 ms Literally the same as for <signal.hpp>. Plus for graph_impl.hpp impact theory.

Time to instantiate events, event_source with unique type: [0.88 ms - 3.96 ms] average - 2.46 ms. The same as for signal too. Most likely it is time to instantiate std::shared_ptr<T>.

Time to instantiate make_source and make_never with unique type: [12.50 ms - 24.71 ms] average - 17.84 ms. Slightly more than time to instantiate make_var. Most likely it is additional cost to instantiate std::vector<T> used as a container for event_stream_node's event values. The same conclusion about avoiding make_source and make_never in headers.

YarikTH commented 1 year ago

<context.hpp>

Extra include time: [63.08 ms - 107.68 ms] average - 82.63 ms Comparable with <signal.hpp> and <events.hpp>

Time to create the first ureact::context: [46.63 ms - 169.18 ms] average - 94.10 ms It is surprisingly high, considering that ureact::context is a concrete class and I expected that it is complete as soon as we include it.

Summary: [109.71 ms - 272.64 ms] average - 176.73 ms

I assume this time could be decreased down to almost zero in static library mode, where both context and react_graph as concrete classes can be defined inside the library and stop bloating compilation times.

UPDATE Yes, it is actually header-only library problem. After applying minimal efforts to make a static library (there is some other things are left to hide). Summary time after change: [8.78 ms - 29.51 ms] average - 16.56 ms This timing is insignificant. It is literally time to include more or less popular std headers that would be likely included anyway.