BenchmarkBuildImage builds an image from the googleapis corpus (1574 proto files), matching TestGoogleapis. Exercises the proto-source read path that allocates an io.Copy fallback buffer per file.
(b *testing.B)
| 461 | // files), matching TestGoogleapis. Exercises the proto-source read path that |
| 462 | // allocates an io.Copy fallback buffer per file. |
| 463 | func BenchmarkBuildImage(b *testing.B) { |
| 464 | googleapisDirPath := buftesting.GetGoogleapisDirPath(b, buftestingDirPath) |
| 465 | moduleSet, err := bufmoduletesting.NewModuleSetForDirPath(googleapisDirPath) |
| 466 | if err != nil { |
| 467 | b.Fatal(err) |
| 468 | } |
| 469 | logger := slogtestext.NewLogger(b) |
| 470 | b.ResetTimer() |
| 471 | b.ReportAllocs() |
| 472 | for b.Loop() { |
| 473 | if _, err := bufimage.BuildImage( |
| 474 | b.Context(), |
| 475 | logger, |
| 476 | bufmodule.ModuleSetToModuleReadBucketWithOnlyProtoFiles(moduleSet), |
| 477 | bufimage.WithExcludeSourceCodeInfo(), |
| 478 | bufimage.WithNoParallelism(), |
| 479 | ); err != nil { |
| 480 | b.Fatal(err) |
| 481 | } |
| 482 | } |
| 483 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…