]> Cypherpunks repositories - gostls13.git/commit
testing: improve b.Loop example
authorAustin Clements <austin@google.com>
Thu, 12 Dec 2024 23:19:43 +0000 (18:19 -0500)
committerGopher Robot <gobot@golang.org>
Mon, 16 Dec 2024 05:41:23 +0000 (21:41 -0800)
commit6bd56fcaebde61eb6bd21906a7d7136d009be4a6
treea922eaa5cd582651e361dba2063ba422cc9d5707
parent090748d6c7973e9bb8f5efe069135c8ea0f0d89c
testing: improve b.Loop example

The current b.Loop example doesn't focus on the basic usage of b.Loop.
Replace this with a new example that uses (slightly) more realistic
things to demonstrate the most salient points of b.Loop.

We also move the example into an example file so that we can write a
real Benchmark function and a real function to be benchmarks, which
makes this much closer to what a user would actually write.

Updates #61515.

Change-Id: I4d830b3bfe3eb3cd8cdecef469fea0541baebb43
Reviewed-on: https://go-review.googlesource.com/c/go/+/635896
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/testing/benchmark_test.go
src/testing/example_loop_test.go [new file with mode: 0644]