[FR] Setup and teardown that only runs once for a benchmark with the same parameters

Abierto
#1,874 0 comentarios 2 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
cpp
Área
performance

Línea de trabajo

Comienza en el punto de entrada RegisterBenchmark descrito en el issue y rastrea cómo se gestionan los parámetros del benchmark, las repeticiones, la configuración y la limpieza. Define cómo deben comportarse SetupOnce y TeardownOnce para cada conjunto de parámetros, incluido el ejemplo de formato de archivo indicado; el payload no especifica archivos ni tests que ejecutar.

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.
Setup and Teardown run for every repetition of the benchmark. As the runner gathers timings it keeps running setup and teardown unnecessarily.

Describe the solution you'd like
For a given benchmark with a specific set of parameters, there should be a way to specify a setup and teardown that runs exactly once.
e.g. RegisterBenchmark(name, func, params...)->SetupOnce(functor)->TeardownOnce(functor).

Describe alternatives you've considered
I haven't found an alternative other than allowing setup and teardown to run unnecessarily and consume resources.

Additional context
If I were trying to benchmark reading the same data from alternative file formats. I might make a general function that can be parameterized on the different formats. The setup would create the file, teardown would delete the file, and the benchmark would extract the data.

It's unnecessary for the setup and teardown to do that again and again for each repetition of the same benchmark with the same parameters. Especially if, say, you had to make the file very large to get accurate benchmark data.

Lenguaje dominante
C++
Estrellas
10.5k
Forks
1.8k
Merge medio
1 d 15 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.