Skip to content

[FR] Allow complexity to fit a constant offset #2391

Open

Description

@BrianSipos

Is your feature request related to a problem? Please describe.
For some (cryptographic) algorithms that I'm benchmarking, the real complexity is something like O(a*N + C) where there is a fixed minimum running time that is non-trivial. Using the builtin oN complexity function always has a high RMS even though the actual times are quite linear (with an offset).

Describe the solution you'd like
Provide a different complexity fitter that will include a constant offset, with identical behavior to current complexity functions (no change to existing behaviors). When used with the new complexity function, a new Run output line would be included for the constant offset.

Describe alternatives you've considered
I can refactor all of my own functions to attempt to estimate the N=0 offset value.
But that will not be the same as a proper linear regression with offset, which has a closed form solution.

Additional context
An example of the output for one of the heavy-weight algorithms (ML-DSA-87) for varying plaintext sizes, which has a strong offset of ~700 us. Without fitting the offset, the RMS is very high.

BM_SigSign/MLDSA87/1024        709327 ns       654350 ns         4307
BM_SigSign/MLDSA87/4096        730189 ns       673641 ns         4299
BM_SigSign/MLDSA87/32768       800954 ns       738861 ns         3778
BM_SigSign/MLDSA87/262144     1197191 ns      1104392 ns         2440
BM_SigSign/MLDSA87/1048576    2587894 ns      2385932 ns         1185
BM_SigSign/MLDSA87_BigO          2.61 N          2.41 N    
BM_SigSign/MLDSA87_RMS             50 %            50 %    

Activity

  1. BrianSipos commented on Nov 20, 2026

    @BrianSipos
    Author

    I understand that true Big-O is about asymptotic behavior, but this issue is about practical benchmarking with real situations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions