LoginSignup
2
0

More than 3 years have passed since last update.

[Go]ベンチマーク関数で回数を指定する方法

Posted at

Go1.12からベンチマーク回数を指定できるようになった。
-benchtimeはベンチ実行時間であったが、指定した数値にxを付与することで「実行回数」として扱うことが出来る。

回数を指定する場合

go test -bench . ./app/... -benchtime 10000x

時間を指定する場合

go test -bench . ./app/... -benchtime 1h30s

参考
https://golang.org/cmd/go/#hdr-Testing_flags

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0