[FR] Allow complexity to fit a constant offset

Abierto
#2,391 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
cpp
Área
performance

Línea de trabajo

Complexity fitters are implemented in src/complexity.cc (ComputeBigO) and exposed through the BigO enum in include/benchmark/benchmark.h; the BigO and RMS output columns are emitted by the reporters in src/reporter.cc and src/json_reporter.cc. Start by reading src/complexity.cc alongside test/complexity_test.cc to see how oN/oNLogN fits are computed and tested. Done means a new offset-aware fitter selectable from the benchmark registration, an extra output line for the constant term, and passing complexity tests.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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 %    
Lenguaje dominante
C++
Estrellas
10.5k
Forks
1.8k
Merge medio
2 d 1 h
PR fusionados (30 d)
28

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de google/benchmark

Todos los issues de google/benchmark

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.