Skip to content

Conversation

jhesketh
Copy link
Contributor

@jhesketh jhesketh commented Oct 16, 2024

What this PR does

Which issue(s) this PR fixes or relates to

Fixes #

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

@jhesketh jhesketh requested a review from a team as a code owner October 16, 2024 04:12
Copy link
Contributor

@charleskorn charleskorn left a comment

Choose a reason for hiding this comment

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

Overall LGTM.

I'd like to see a test for the case where the scalar values are different at different time steps, and tests for the case where the min parameter is greater than the max parameter for all steps and just some steps.

I'd also be interested to see some benchmarks: both a comparison of clamp in MQE and Prometheus' engine, and the impact of these changes on already supported functions.

@jhesketh
Copy link
Contributor Author

Benchmarks

Clamp on this branch:

goos: linux
goarch: amd64
pkg: github.com/grafana/mimir/pkg/streamingpromql/benchmarks
cpu: Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
                                                              │  Prometheus   │               Mimir                │
                                                              │    sec/op     │   sec/op     vs base               │
Query/abs(a_1),_instant_query-8                                  666.1µ ±  4%   620.2µ ± 3%   -6.90% (p=0.002 n=6)
Query/abs(a_1),_range_query_with_100_steps-8                     712.3µ ±  3%   640.3µ ± 4%  -10.11% (p=0.002 n=6)
Query/abs(a_1),_range_query_with_1000_steps-8                   1010.9µ ±  2%   793.6µ ± 2%  -21.50% (p=0.002 n=6)
Query/abs(a_100),_instant_query-8                                2.323m ±  2%   2.181m ± 2%   -6.13% (p=0.002 n=6)
Query/abs(a_100),_range_query_with_100_steps-8                   4.751m ±  1%   3.421m ± 1%  -28.00% (p=0.002 n=6)
Query/abs(a_100),_range_query_with_1000_steps-8                  27.61m ± 12%   14.29m ± 7%  -48.23% (p=0.002 n=6)
Query/abs(a_2000),_instant_query-8                               27.84m ±  2%   26.24m ± 5%   -5.74% (p=0.004 n=6)
Query/abs(a_2000),_range_query_with_100_steps-8                  92.38m ±  4%   52.85m ± 2%  -42.79% (p=0.002 n=6)
Query/abs(a_2000),_range_query_with_1000_steps-8                 727.1m ±  1%   258.3m ± 1%  -64.47% (p=0.002 n=6)
Query/clamp(a_1,_100,_1000),_instant_query-8                     682.4µ ±  7%   629.1µ ± 2%   -7.81% (p=0.002 n=6)
Query/clamp(a_1,_100,_1000),_range_query_with_100_steps-8        772.4µ ±  4%   639.5µ ± 3%  -17.21% (p=0.002 n=6)
Query/clamp(a_1,_100,_1000),_range_query_with_1000_steps-8      1415.7µ ±  2%   797.5µ ± 4%  -43.67% (p=0.002 n=6)
Query/clamp(a_100,_100,_1000),_instant_query-8                   2.308m ±  1%   2.193m ± 6%        ~ (p=0.065 n=6)
Query/clamp(a_100,_100,_1000),_range_query_with_100_steps-8      4.843m ±  1%   3.478m ± 2%  -28.17% (p=0.002 n=6)
Query/clamp(a_100,_100,_1000),_range_query_with_1000_steps-8     31.03m ±  6%   14.50m ± 4%  -53.27% (p=0.002 n=6)
Query/clamp(a_2000,_100,_1000),_instant_query-8                  28.02m ±  2%   26.00m ± 2%   -7.22% (p=0.002 n=6)
Query/clamp(a_2000,_100,_1000),_range_query_with_100_steps-8     93.14m ±  3%   52.46m ± 3%  -43.68% (p=0.002 n=6)
Query/clamp(a_2000,_100,_1000),_range_query_with_1000_steps-8    741.3m ±  2%   258.7m ± 1%  -65.10% (p=0.002 n=6)
geomean                                                          8.954m         6.133m       -31.51%

                                                              │  Prometheus   │                Mimir                │
                                                              │     B/op      │     B/op      vs base               │
Query/abs(a_1),_instant_query-8                                  22.12Ki ± 0%   20.05Ki ± 0%   -9.37% (p=0.002 n=6)
Query/abs(a_1),_range_query_with_100_steps-8                     25.54Ki ± 0%   20.78Ki ± 0%  -18.65% (p=0.002 n=6)
Query/abs(a_1),_range_query_with_1000_steps-8                    51.39Ki ± 0%   25.19Ki ± 0%  -50.98% (p=0.002 n=6)
Query/abs(a_100),_instant_query-8                                209.5Ki ± 0%   150.6Ki ± 0%  -28.12% (p=0.002 n=6)
Query/abs(a_100),_range_query_with_100_steps-8                   261.8Ki ± 0%   207.9Ki ± 0%  -20.59% (p=0.002 n=6)
Query/abs(a_100),_range_query_with_1000_steps-8                  710.8Ki ± 0%   629.7Ki ± 0%  -11.40% (p=0.002 n=6)
Query/abs(a_2000),_instant_query-8                               3.872Mi ± 0%   2.650Mi ± 1%  -31.55% (p=0.002 n=6)
Query/abs(a_2000),_range_query_with_100_steps-8                  4.873Mi ± 0%   3.824Mi ± 0%  -21.52% (p=0.002 n=6)
Query/abs(a_2000),_range_query_with_1000_steps-8                 13.35Mi ± 0%   11.89Mi ± 1%  -10.93% (p=0.002 n=6)
Query/clamp(a_1,_100,_1000),_instant_query-8                     25.66Ki ± 0%   20.55Ki ± 0%  -19.89% (p=0.002 n=6)
Query/clamp(a_1,_100,_1000),_range_query_with_100_steps-8        33.80Ki ± 0%   21.28Ki ± 0%  -37.04% (p=0.002 n=6)
Query/clamp(a_1,_100,_1000),_range_query_with_1000_steps-8      101.93Ki ± 0%   25.64Ki ± 0%  -74.84% (p=0.002 n=6)
Query/clamp(a_100,_100,_1000),_instant_query-8                   213.0Ki ± 0%   149.5Ki ± 0%  -29.81% (p=0.002 n=6)
Query/clamp(a_100,_100,_1000),_range_query_with_100_steps-8      270.2Ki ± 0%   206.4Ki ± 0%  -23.61% (p=0.002 n=6)
Query/clamp(a_100,_100,_1000),_range_query_with_1000_steps-8     762.1Ki ± 0%   627.3Ki ± 0%  -17.69% (p=0.002 n=6)
Query/clamp(a_2000,_100,_1000),_instant_query-8                  3.878Mi ± 0%   2.592Mi ± 0%  -33.17% (p=0.002 n=6)
Query/clamp(a_2000,_100,_1000),_range_query_with_100_steps-8     4.885Mi ± 6%   3.770Mi ± 1%  -22.83% (p=0.002 n=6)
Query/clamp(a_2000,_100,_1000),_range_query_with_1000_steps-8    13.38Mi ± 1%   11.80Mi ± 1%  -11.81% (p=0.002 n=6)
geomean                                                          435.9Ki        310.5Ki       -28.77%

                                                              │  Prometheus  │               Mimir                │
                                                              │  allocs/op   │  allocs/op   vs base               │
Query/abs(a_1),_instant_query-8                                   404.0 ± 0%    346.0 ± 0%  -14.36% (p=0.002 n=6)
Query/abs(a_1),_range_query_with_100_steps-8                      513.0 ± 0%    353.0 ± 0%  -31.19% (p=0.002 n=6)
Query/abs(a_1),_range_query_with_1000_steps-8                    1439.0 ± 0%    379.0 ± 0%  -73.66% (p=0.002 n=6)
Query/abs(a_100),_instant_query-8                                2.425k ± 0%   2.259k ± 0%   -6.87% (p=0.002 n=6)
Query/abs(a_100),_range_query_with_100_steps-8                   2.832k ± 0%   2.668k ± 0%   -5.77% (p=0.002 n=6)
Query/abs(a_100),_range_query_with_1000_steps-8                  6.348k ± 0%   5.282k ± 0%  -16.79% (p=0.002 n=6)
Query/abs(a_2000),_instant_query-8                               40.92k ± 0%   38.84k ± 0%   -5.07% (p=0.002 n=6)
Query/abs(a_2000),_range_query_with_100_steps-8                  47.06k ± 0%   46.89k ± 0%   -0.36% (p=0.002 n=6)
Query/abs(a_2000),_range_query_with_1000_steps-8                100.09k ± 0%   98.93k ± 0%   -1.16% (p=0.002 n=6)
Query/clamp(a_1,_100,_1000),_instant_query-8                      476.0 ± 0%    361.0 ± 0%  -24.16% (p=0.002 n=6)
Query/clamp(a_1,_100,_1000),_range_query_with_100_steps-8         783.0 ± 0%    368.0 ± 0%  -53.00% (p=0.002 n=6)
Query/clamp(a_1,_100,_1000),_range_query_with_1000_steps-8       3510.0 ± 0%    394.0 ± 0%  -88.77% (p=0.002 n=6)
Query/clamp(a_100,_100,_1000),_instant_query-8                   2.497k ± 0%   2.266k ± 0%   -9.25% (p=0.002 n=6)
Query/clamp(a_100,_100,_1000),_range_query_with_100_steps-8      3.102k ± 0%   2.676k ± 0%  -13.73% (p=0.002 n=6)
Query/clamp(a_100,_100,_1000),_range_query_with_1000_steps-8     8.419k ± 0%   5.290k ± 0%  -37.17% (p=0.002 n=6)
Query/clamp(a_2000,_100,_1000),_instant_query-8                  41.00k ± 0%   38.83k ± 0%   -5.29% (p=0.002 n=6)
Query/clamp(a_2000,_100,_1000),_range_query_with_100_steps-8     47.33k ± 1%   46.89k ± 0%   -0.94% (p=0.002 n=6)
Query/clamp(a_2000,_100,_1000),_range_query_with_1000_steps-8   102.13k ± 0%   98.94k ± 0%   -3.12% (p=0.002 n=6)
geomean                                                          5.716k        4.035k       -29.41%

                                                              │  Prometheus  │                Mimir                │
                                                              │      B       │      B        vs base               │
Query/abs(a_1),_instant_query-8                                 71.66Ki ± 1%   70.71Ki ± 2%        ~ (p=0.180 n=6)
Query/abs(a_1),_range_query_with_100_steps-8                    71.16Ki ± 1%   70.28Ki ± 3%        ~ (p=0.065 n=6)
Query/abs(a_1),_range_query_with_1000_steps-8                   69.83Ki ± 1%   69.09Ki ± 2%        ~ (p=0.589 n=6)
Query/abs(a_100),_instant_query-8                               68.17Ki ± 1%   67.89Ki ± 1%        ~ (p=0.065 n=6)
Query/abs(a_100),_range_query_with_100_steps-8                  69.14Ki ± 1%   68.48Ki ± 1%        ~ (p=0.132 n=6)
Query/abs(a_100),_range_query_with_1000_steps-8                 72.30Ki ± 2%   71.17Ki ± 1%        ~ (p=0.093 n=6)
Query/abs(a_2000),_instant_query-8                              69.85Ki ± 1%   69.78Ki ± 1%        ~ (p=0.818 n=6)
Query/abs(a_2000),_range_query_with_100_steps-8                 81.90Ki ± 2%   77.81Ki ± 2%   -4.98% (p=0.002 n=6)
Query/abs(a_2000),_range_query_with_1000_steps-8                146.4Ki ± 0%   131.2Ki ± 1%  -10.40% (p=0.002 n=6)
Query/clamp(a_1,_100,_1000),_instant_query-8                    70.26Ki ± 2%   70.50Ki ± 2%        ~ (p=0.589 n=6)
Query/clamp(a_1,_100,_1000),_range_query_with_100_steps-8       70.26Ki ± 3%   70.85Ki ± 2%        ~ (p=0.180 n=6)
Query/clamp(a_1,_100,_1000),_range_query_with_1000_steps-8      70.03Ki ± 1%   68.66Ki ± 3%   -1.96% (p=0.004 n=6)
Query/clamp(a_100,_100,_1000),_instant_query-8                  68.27Ki ± 1%   67.96Ki ± 2%        ~ (p=0.310 n=6)
Query/clamp(a_100,_100,_1000),_range_query_with_100_steps-8     68.75Ki ± 2%   68.93Ki ± 1%        ~ (p=0.937 n=6)
Query/clamp(a_100,_100,_1000),_range_query_with_1000_steps-8    72.80Ki ± 2%   70.97Ki ± 1%   -2.52% (p=0.002 n=6)
Query/clamp(a_2000,_100,_1000),_instant_query-8                 70.15Ki ± 2%   69.95Ki ± 2%        ~ (p=0.485 n=6)
Query/clamp(a_2000,_100,_1000),_range_query_with_100_steps-8    82.57Ki ± 3%   78.03Ki ± 1%   -5.50% (p=0.002 n=6)
Query/clamp(a_2000,_100,_1000),_range_query_with_1000_steps-8   146.2Ki ± 0%   131.5Ki ± 1%  -10.00% (p=0.002 n=6)
geomean                                                         77.50Ki        75.67Ki        -2.35%

TL;DR: clamp is ~30% more efficient

This branch vs main:

goos: linux
goarch: amd64
pkg: github.com/grafana/mimir/pkg/streamingpromql/benchmarks
cpu: Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
                                                                                │   main.txt   │             clamp.txt              │
                                                                                │    sec/op    │    sec/op     vs base              │
Query/abs(a_1),_instant_query/engine=Mimir-8                                      634.9µ ± 12%   620.2µ ±  3%       ~ (p=0.180 n=6)
Query/abs(a_1),_instant_query/engine=Prometheus-8                                 648.7µ ±  3%   666.1µ ±  4%       ~ (p=0.180 n=6)
Query/abs(a_1),_range_query_with_100_steps/engine=Mimir-8                         655.8µ ±  3%   640.3µ ±  4%       ~ (p=0.394 n=6)
Query/abs(a_1),_range_query_with_100_steps/engine=Prometheus-8                    703.8µ ±  4%   712.3µ ±  3%       ~ (p=0.310 n=6)
Query/abs(a_1),_range_query_with_1000_steps/engine=Mimir-8                        782.9µ ±  2%   793.6µ ±  2%       ~ (p=0.180 n=6)
Query/abs(a_1),_range_query_with_1000_steps/engine=Prometheus-8                   1.026m ±  2%   1.011m ±  2%       ~ (p=0.589 n=6)
Query/abs(a_100),_instant_query/engine=Mimir-8                                    2.179m ±  2%   2.181m ±  2%       ~ (p=0.937 n=6)
Query/abs(a_100),_instant_query/engine=Prometheus-8                               2.305m ±  7%   2.323m ±  2%       ~ (p=0.065 n=6)
Query/abs(a_100),_range_query_with_100_steps/engine=Mimir-8                       3.427m ±  2%   3.421m ±  1%       ~ (p=0.818 n=6)
Query/abs(a_100),_range_query_with_100_steps/engine=Prometheus-8                  4.759m ±  1%   4.751m ±  1%       ~ (p=0.589 n=6)
Query/abs(a_100),_range_query_with_1000_steps/engine=Mimir-8                      14.74m ±  7%   14.29m ±  7%       ~ (p=0.818 n=6)
Query/abs(a_100),_range_query_with_1000_steps/engine=Prometheus-8                 27.24m ± 10%   27.61m ± 12%       ~ (p=0.699 n=6)
Query/abs(a_2000),_instant_query/engine=Mimir-8                                   26.46m ±  3%   26.24m ±  5%       ~ (p=0.699 n=6)
Query/abs(a_2000),_instant_query/engine=Prometheus-8                              27.58m ±  4%   27.84m ±  2%       ~ (p=0.180 n=6)
Query/abs(a_2000),_range_query_with_100_steps/engine=Mimir-8                      52.09m ±  2%   52.85m ±  2%       ~ (p=0.065 n=6)
Query/abs(a_2000),_range_query_with_100_steps/engine=Prometheus-8                 92.46m ±  2%   92.38m ±  4%       ~ (p=0.589 n=6)
Query/abs(a_2000),_range_query_with_1000_steps/engine=Mimir-8                     257.2m ± 19%   258.3m ±  1%       ~ (p=0.937 n=6)
Query/abs(a_2000),_range_query_with_1000_steps/engine=Prometheus-8                727.0m ±  2%   727.1m ±  1%       ~ (p=0.818 n=6)
Query/clamp(a_1,_100,_1000),_instant_query/engine=Mimir-8                                        629.1µ ±  2%
Query/clamp(a_1,_100,_1000),_instant_query/engine=Prometheus-8                                   682.4µ ±  7%
Query/clamp(a_1,_100,_1000),_range_query_with_100_steps/engine=Mimir-8                           639.5µ ±  3%
Query/clamp(a_1,_100,_1000),_range_query_with_100_steps/engine=Prometheus-8                      772.4µ ±  4%
Query/clamp(a_1,_100,_1000),_range_query_with_1000_steps/engine=Mimir-8                          797.5µ ±  4%
Query/clamp(a_1,_100,_1000),_range_query_with_1000_steps/engine=Prometheus-8                     1.416m ±  2%
Query/clamp(a_100,_100,_1000),_instant_query/engine=Mimir-8                                      2.193m ±  6%
Query/clamp(a_100,_100,_1000),_instant_query/engine=Prometheus-8                                 2.308m ±  1%
Query/clamp(a_100,_100,_1000),_range_query_with_100_steps/engine=Mimir-8                         3.478m ±  2%
Query/clamp(a_100,_100,_1000),_range_query_with_100_steps/engine=Prometheus-8                    4.843m ±  1%
Query/clamp(a_100,_100,_1000),_range_query_with_1000_steps/engine=Mimir-8                        14.50m ±  4%
Query/clamp(a_100,_100,_1000),_range_query_with_1000_steps/engine=Prometheus-8                   31.03m ±  6%
Query/clamp(a_2000,_100,_1000),_instant_query/engine=Mimir-8                                     26.00m ±  2%
Query/clamp(a_2000,_100,_1000),_instant_query/engine=Prometheus-8                                28.02m ±  2%
Query/clamp(a_2000,_100,_1000),_range_query_with_100_steps/engine=Mimir-8                        52.46m ±  3%
Query/clamp(a_2000,_100,_1000),_range_query_with_100_steps/engine=Prometheus-8                   93.14m ±  3%
Query/clamp(a_2000,_100,_1000),_range_query_with_1000_steps/engine=Mimir-8                       258.7m ±  1%
Query/clamp(a_2000,_100,_1000),_range_query_with_1000_steps/engine=Prometheus-8                  741.3m ±  2%
geomean                                                                           7.280m         7.410m        -0.02%

                                                                                │   main.txt   │             clamp.txt              │
                                                                                │     B/op     │     B/op      vs base              │
Query/abs(a_1),_instant_query/engine=Mimir-8                                      19.98Ki ± 0%   20.05Ki ± 0%  +0.34% (p=0.004 n=6)
Query/abs(a_1),_instant_query/engine=Prometheus-8                                 22.11Ki ± 0%   22.12Ki ± 0%       ~ (p=1.000 n=6)
Query/abs(a_1),_range_query_with_100_steps/engine=Mimir-8                         20.71Ki ± 0%   20.78Ki ± 0%       ~ (p=0.132 n=6)
Query/abs(a_1),_range_query_with_100_steps/engine=Prometheus-8                    25.57Ki ± 0%   25.54Ki ± 0%       ~ (p=0.223 n=6)
Query/abs(a_1),_range_query_with_1000_steps/engine=Mimir-8                        25.18Ki ± 0%   25.19Ki ± 0%       ~ (p=0.699 n=6)
Query/abs(a_1),_range_query_with_1000_steps/engine=Prometheus-8                   51.39Ki ± 0%   51.39Ki ± 0%       ~ (p=0.699 n=6)
Query/abs(a_100),_instant_query/engine=Mimir-8                                    150.4Ki ± 0%   150.6Ki ± 0%       ~ (p=0.093 n=6)
Query/abs(a_100),_instant_query/engine=Prometheus-8                               209.4Ki ± 0%   209.5Ki ± 0%       ~ (p=0.818 n=6)
Query/abs(a_100),_range_query_with_100_steps/engine=Mimir-8                       207.7Ki ± 0%   207.9Ki ± 0%       ~ (p=0.394 n=6)
Query/abs(a_100),_range_query_with_100_steps/engine=Prometheus-8                  261.9Ki ± 0%   261.8Ki ± 0%       ~ (p=0.818 n=6)
Query/abs(a_100),_range_query_with_1000_steps/engine=Mimir-8                      629.8Ki ± 1%   629.7Ki ± 0%       ~ (p=0.485 n=6)
Query/abs(a_100),_range_query_with_1000_steps/engine=Prometheus-8                 710.0Ki ± 1%   710.8Ki ± 0%       ~ (p=0.132 n=6)
Query/abs(a_2000),_instant_query/engine=Mimir-8                                   2.641Mi ± 1%   2.650Mi ± 1%       ~ (p=0.699 n=6)
Query/abs(a_2000),_instant_query/engine=Prometheus-8                              3.873Mi ± 0%   3.872Mi ± 0%       ~ (p=0.180 n=6)
Query/abs(a_2000),_range_query_with_100_steps/engine=Mimir-8                      3.826Mi ± 1%   3.824Mi ± 0%       ~ (p=0.937 n=6)
Query/abs(a_2000),_range_query_with_100_steps/engine=Prometheus-8                 4.854Mi ± 0%   4.873Mi ± 0%       ~ (p=0.065 n=6)
Query/abs(a_2000),_range_query_with_1000_steps/engine=Mimir-8                     11.89Mi ± 0%   11.89Mi ± 1%       ~ (p=0.937 n=6)
Query/abs(a_2000),_range_query_with_1000_steps/engine=Prometheus-8                13.36Mi ± 1%   13.35Mi ± 0%       ~ (p=0.394 n=6)
Query/clamp(a_1,_100,_1000),_instant_query/engine=Mimir-8                                        20.55Ki ± 0%
Query/clamp(a_1,_100,_1000),_instant_query/engine=Prometheus-8                                   25.66Ki ± 0%
Query/clamp(a_1,_100,_1000),_range_query_with_100_steps/engine=Mimir-8                           21.28Ki ± 0%
Query/clamp(a_1,_100,_1000),_range_query_with_100_steps/engine=Prometheus-8                      33.80Ki ± 0%
Query/clamp(a_1,_100,_1000),_range_query_with_1000_steps/engine=Mimir-8                          25.64Ki ± 0%
Query/clamp(a_1,_100,_1000),_range_query_with_1000_steps/engine=Prometheus-8                     101.9Ki ± 0%
Query/clamp(a_100,_100,_1000),_instant_query/engine=Mimir-8                                      149.5Ki ± 0%
Query/clamp(a_100,_100,_1000),_instant_query/engine=Prometheus-8                                 213.0Ki ± 0%
Query/clamp(a_100,_100,_1000),_range_query_with_100_steps/engine=Mimir-8                         206.4Ki ± 0%
Query/clamp(a_100,_100,_1000),_range_query_with_100_steps/engine=Prometheus-8                    270.2Ki ± 0%
Query/clamp(a_100,_100,_1000),_range_query_with_1000_steps/engine=Mimir-8                        627.3Ki ± 0%
Query/clamp(a_100,_100,_1000),_range_query_with_1000_steps/engine=Prometheus-8                   762.1Ki ± 0%
Query/clamp(a_2000,_100,_1000),_instant_query/engine=Mimir-8                                     2.592Mi ± 0%
Query/clamp(a_2000,_100,_1000),_instant_query/engine=Prometheus-8                                3.878Mi ± 0%
Query/clamp(a_2000,_100,_1000),_range_query_with_100_steps/engine=Mimir-8                        3.770Mi ± 1%
Query/clamp(a_2000,_100,_1000),_range_query_with_100_steps/engine=Prometheus-8                   4.885Mi ± 6%
Query/clamp(a_2000,_100,_1000),_range_query_with_1000_steps/engine=Mimir-8                       11.80Mi ± 1%
Query/clamp(a_2000,_100,_1000),_range_query_with_1000_steps/engine=Prometheus-8                  13.38Mi ± 1%
geomean                                                                           355.1Ki        367.9Ki       +0.08%

                                                                                │  main.txt   │              clamp.txt              │
                                                                                │  allocs/op  │  allocs/op   vs base                │
Query/abs(a_1),_instant_query/engine=Mimir-8                                       346.0 ± 0%    346.0 ± 0%       ~ (p=1.000 n=6) ¹
Query/abs(a_1),_instant_query/engine=Prometheus-8                                  404.0 ± 0%    404.0 ± 0%       ~ (p=1.000 n=6) ¹
Query/abs(a_1),_range_query_with_100_steps/engine=Mimir-8                          353.0 ± 0%    353.0 ± 0%       ~ (p=1.000 n=6) ¹
Query/abs(a_1),_range_query_with_100_steps/engine=Prometheus-8                     513.0 ± 0%    513.0 ± 0%       ~ (p=1.000 n=6) ¹
Query/abs(a_1),_range_query_with_1000_steps/engine=Mimir-8                         379.0 ± 0%    379.0 ± 0%       ~ (p=1.000 n=6) ¹
Query/abs(a_1),_range_query_with_1000_steps/engine=Prometheus-8                   1.440k ± 0%   1.439k ± 0%       ~ (p=1.000 n=6)
Query/abs(a_100),_instant_query/engine=Mimir-8                                    2.258k ± 0%   2.259k ± 0%       ~ (p=1.000 n=6)
Query/abs(a_100),_instant_query/engine=Prometheus-8                               2.425k ± 0%   2.425k ± 0%       ~ (p=1.000 n=6) ¹
Query/abs(a_100),_range_query_with_100_steps/engine=Mimir-8                       2.668k ± 0%   2.668k ± 0%       ~ (p=1.000 n=6)
Query/abs(a_100),_range_query_with_100_steps/engine=Prometheus-8                  2.832k ± 0%   2.832k ± 0%       ~ (p=0.545 n=6)
Query/abs(a_100),_range_query_with_1000_steps/engine=Mimir-8                      5.282k ± 0%   5.282k ± 0%       ~ (p=0.827 n=6)
Query/abs(a_100),_range_query_with_1000_steps/engine=Prometheus-8                 6.348k ± 0%   6.348k ± 0%       ~ (p=0.647 n=6)
Query/abs(a_2000),_instant_query/engine=Mimir-8                                   38.82k ± 0%   38.84k ± 0%       ~ (p=0.102 n=6)
Query/abs(a_2000),_instant_query/engine=Prometheus-8                              40.91k ± 0%   40.92k ± 0%       ~ (p=0.251 n=6)
Query/abs(a_2000),_range_query_with_100_steps/engine=Mimir-8                      46.88k ± 0%   46.89k ± 0%  +0.01% (p=0.011 n=6)
Query/abs(a_2000),_range_query_with_100_steps/engine=Prometheus-8                 47.05k ± 0%   47.06k ± 0%  +0.01% (p=0.041 n=6)
Query/abs(a_2000),_range_query_with_1000_steps/engine=Mimir-8                     98.94k ± 0%   98.93k ± 0%       ~ (p=0.729 n=6)
Query/abs(a_2000),_range_query_with_1000_steps/engine=Prometheus-8                100.1k ± 0%   100.1k ± 0%  +0.01% (p=0.039 n=6)
Query/clamp(a_1,_100,_1000),_instant_query/engine=Mimir-8                                        361.0 ± 0%
Query/clamp(a_1,_100,_1000),_instant_query/engine=Prometheus-8                                   476.0 ± 0%
Query/clamp(a_1,_100,_1000),_range_query_with_100_steps/engine=Mimir-8                           368.0 ± 0%
Query/clamp(a_1,_100,_1000),_range_query_with_100_steps/engine=Prometheus-8                      783.0 ± 0%
Query/clamp(a_1,_100,_1000),_range_query_with_1000_steps/engine=Mimir-8                          394.0 ± 0%
Query/clamp(a_1,_100,_1000),_range_query_with_1000_steps/engine=Prometheus-8                    3.510k ± 0%
Query/clamp(a_100,_100,_1000),_instant_query/engine=Mimir-8                                     2.266k ± 0%
Query/clamp(a_100,_100,_1000),_instant_query/engine=Prometheus-8                                2.497k ± 0%
Query/clamp(a_100,_100,_1000),_range_query_with_100_steps/engine=Mimir-8                        2.676k ± 0%
Query/clamp(a_100,_100,_1000),_range_query_with_100_steps/engine=Prometheus-8                   3.102k ± 0%
Query/clamp(a_100,_100,_1000),_range_query_with_1000_steps/engine=Mimir-8                       5.290k ± 0%
Query/clamp(a_100,_100,_1000),_range_query_with_1000_steps/engine=Prometheus-8                  8.419k ± 0%
Query/clamp(a_2000,_100,_1000),_instant_query/engine=Mimir-8                                    38.83k ± 0%
Query/clamp(a_2000,_100,_1000),_instant_query/engine=Prometheus-8                               41.00k ± 0%
Query/clamp(a_2000,_100,_1000),_range_query_with_100_steps/engine=Mimir-8                       46.89k ± 0%
Query/clamp(a_2000,_100,_1000),_range_query_with_100_steps/engine=Prometheus-8                  47.33k ± 1%
Query/clamp(a_2000,_100,_1000),_range_query_with_1000_steps/engine=Mimir-8                      98.94k ± 0%
Query/clamp(a_2000,_100,_1000),_range_query_with_1000_steps/engine=Prometheus-8                 102.1k ± 0%
geomean                                                                           4.537k        4.802k       +0.01%
¹ all samples are equal

                                                                                │   main.txt   │             clamp.txt              │
                                                                                │      B       │      B        vs base              │
Query/abs(a_1),_instant_query/engine=Mimir-8                                      71.44Ki ± 2%   70.71Ki ± 2%       ~ (p=0.416 n=6)
Query/abs(a_1),_instant_query/engine=Prometheus-8                                 71.49Ki ± 3%   71.66Ki ± 1%       ~ (p=0.781 n=6)
Query/abs(a_1),_range_query_with_100_steps/engine=Mimir-8                         70.62Ki ± 3%   70.28Ki ± 3%       ~ (p=0.589 n=6)
Query/abs(a_1),_range_query_with_100_steps/engine=Prometheus-8                    71.04Ki ± 4%   71.16Ki ± 1%       ~ (p=0.420 n=6)
Query/abs(a_1),_range_query_with_1000_steps/engine=Mimir-8                        69.98Ki ± 1%   69.09Ki ± 2%       ~ (p=0.699 n=6)
Query/abs(a_1),_range_query_with_1000_steps/engine=Prometheus-8                   69.33Ki ± 1%   69.83Ki ± 1%       ~ (p=0.310 n=6)
Query/abs(a_100),_instant_query/engine=Mimir-8                                    68.03Ki ± 2%   67.89Ki ± 1%       ~ (p=0.818 n=6)
Query/abs(a_100),_instant_query/engine=Prometheus-8                               68.81Ki ± 1%   68.17Ki ± 1%       ~ (p=0.093 n=6)
Query/abs(a_100),_range_query_with_100_steps/engine=Mimir-8                       68.74Ki ± 2%   68.48Ki ± 1%       ~ (p=0.485 n=6)
Query/abs(a_100),_range_query_with_100_steps/engine=Prometheus-8                  69.45Ki ± 2%   69.14Ki ± 1%       ~ (p=0.589 n=6)
Query/abs(a_100),_range_query_with_1000_steps/engine=Mimir-8                      70.83Ki ± 1%   71.17Ki ± 1%       ~ (p=0.619 n=6)
Query/abs(a_100),_range_query_with_1000_steps/engine=Prometheus-8                 72.57Ki ± 1%   72.30Ki ± 2%       ~ (p=0.394 n=6)
Query/abs(a_2000),_instant_query/engine=Mimir-8                                   69.72Ki ± 2%   69.78Ki ± 1%       ~ (p=0.619 n=6)
Query/abs(a_2000),_instant_query/engine=Prometheus-8                              70.06Ki ± 1%   69.85Ki ± 1%       ~ (p=0.394 n=6)
Query/abs(a_2000),_range_query_with_100_steps/engine=Mimir-8                      77.88Ki ± 2%   77.81Ki ± 2%       ~ (p=0.699 n=6)
Query/abs(a_2000),_range_query_with_100_steps/engine=Prometheus-8                 82.75Ki ± 2%   81.90Ki ± 2%       ~ (p=0.065 n=6)
Query/abs(a_2000),_range_query_with_1000_steps/engine=Mimir-8                     131.9Ki ± 1%   131.2Ki ± 1%  -0.55% (p=0.026 n=6)
Query/abs(a_2000),_range_query_with_1000_steps/engine=Prometheus-8                146.3Ki ± 0%   146.4Ki ± 0%       ~ (p=0.310 n=6)
Query/clamp(a_1,_100,_1000),_instant_query/engine=Mimir-8                                        70.50Ki ± 2%
Query/clamp(a_1,_100,_1000),_instant_query/engine=Prometheus-8                                   70.26Ki ± 2%
Query/clamp(a_1,_100,_1000),_range_query_with_100_steps/engine=Mimir-8                           70.85Ki ± 2%
Query/clamp(a_1,_100,_1000),_range_query_with_100_steps/engine=Prometheus-8                      70.26Ki ± 3%
Query/clamp(a_1,_100,_1000),_range_query_with_1000_steps/engine=Mimir-8                          68.66Ki ± 3%
Query/clamp(a_1,_100,_1000),_range_query_with_1000_steps/engine=Prometheus-8                     70.03Ki ± 1%
Query/clamp(a_100,_100,_1000),_instant_query/engine=Mimir-8                                      67.96Ki ± 2%
Query/clamp(a_100,_100,_1000),_instant_query/engine=Prometheus-8                                 68.27Ki ± 1%
Query/clamp(a_100,_100,_1000),_range_query_with_100_steps/engine=Mimir-8                         68.93Ki ± 1%
Query/clamp(a_100,_100,_1000),_range_query_with_100_steps/engine=Prometheus-8                    68.75Ki ± 2%
Query/clamp(a_100,_100,_1000),_range_query_with_1000_steps/engine=Mimir-8                        70.97Ki ± 1%
Query/clamp(a_100,_100,_1000),_range_query_with_1000_steps/engine=Prometheus-8                   72.80Ki ± 2%
Query/clamp(a_2000,_100,_1000),_instant_query/engine=Mimir-8                                     69.95Ki ± 2%
Query/clamp(a_2000,_100,_1000),_instant_query/engine=Prometheus-8                                70.15Ki ± 2%
Query/clamp(a_2000,_100,_1000),_range_query_with_100_steps/engine=Mimir-8                        78.03Ki ± 1%
Query/clamp(a_2000,_100,_1000),_range_query_with_100_steps/engine=Prometheus-8                   82.57Ki ± 3%
Query/clamp(a_2000,_100,_1000),_range_query_with_1000_steps/engine=Mimir-8                       131.5Ki ± 1%
Query/clamp(a_2000,_100,_1000),_range_query_with_1000_steps/engine=Prometheus-8                  146.2Ki ± 0%
geomean                                                                           76.81Ki        76.58Ki       -0.29%

TL;DR: Refactor has no noticeable impact to abs.

@jhesketh jhesketh enabled auto-merge (squash) October 16, 2024 06:00
@jhesketh jhesketh merged commit 4ec4004 into grafana:main Oct 16, 2024
29 checks passed
@jhesketh jhesketh deleted the jhesketh/mqe-refactor-functions branch October 16, 2024 06:09
@jhesketh jhesketh mentioned this pull request Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants