func benchmarkStats(b *testing.B, r render.Renderer) { report, err := loadReport() if err != nil { b.Fatal(err) } b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { // No way to tell if this was successful :( render.ResetCache() benchmarkStatsResult = r.Stats(report) } }
func BenchmarkTopologyList(b *testing.B) { report, err := loadReport() if err != nil { b.Fatal(err) } b.ReportAllocs() b.ResetTimer() request := &http.Request{ Form: url.Values{}, } for i := 0; i < b.N; i++ { render.ResetCache() topologyRegistry.renderTopologies(report, request) } }
func benchmarkRender(b *testing.B, r render.Renderer) { report, err := loadReport() if err != nil { b.Fatal(err) } b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { render.ResetCache() benchmarkRenderResult = r.Render(report) if len(benchmarkRenderResult) == 0 { b.Errorf("Rendered topology contained no nodes") } } }