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

オープン
#1,874 コメント 0 件 リアクション 2 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
cpp
領域
performance

調査の方向性

Issue に記載された RegisterBenchmark エントリポイントから開始し、ベンチマークパラメータ、反復、セットアップ、ティアダウンがどのように処理されるかを追跡します。提示されたファイル形式の例を含め、各パラメータセットに対して SetupOnce と TeardownOnce がどのように動作すべきかを定義します。payload には実行するファイルやテストの指定はありません。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
C++
スター
10.5k
フォーク
1.8k
平均マージ
1日 15時間
マージ済み PR(30日)
28

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

google/benchmark のほかの issue

google/benchmark の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。