mirror of
https://github.com/weaveworks/scope.git
synced 2026-04-26 20:37:11 +00:00
make report upgrading fast when it's a no-op
The vast majority of the cost is memory allocation, so doing a first pass to see whether any upgrading is necessary at all, and thus avoiding allocation when it isn't, is a massive saving.
This commit is contained in:
@@ -67,6 +67,20 @@ func BenchmarkReportMerge(b *testing.B) {
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkReportUpgrade(b *testing.B) {
|
||||
reports, err := readReportFiles(*benchReportPath)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
r := NewSmartMerger().Merge(reports)
|
||||
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
r.Upgrade()
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkTopologyList(b *testing.B) {
|
||||
benchmarkRender(b, func(report report.Report) {
|
||||
request := &http.Request{
|
||||
|
||||
Reference in New Issue
Block a user