Scan YAML framing preambles once
This commit is contained in:
@@ -72,14 +72,14 @@ func BenchmarkPerformanceYAMLFraming(b *testing.B) {
|
||||
}
|
||||
for _, fixture := range fixtures {
|
||||
b.Run("framing/"+fixture.name, func(b *testing.B) {
|
||||
framed := frameEffectiveYAML(fixture.scope, fixture.native)
|
||||
if len(framed) <= len(fixture.native) || hasYAMLDirective(fixture.native) != strings.Contains(fixture.name, "directive") {
|
||||
framed, hasDirective := frameEffectiveYAML(fixture.scope, fixture.native)
|
||||
if len(framed) <= len(fixture.native) || hasDirective != strings.Contains(fixture.name, "directive") {
|
||||
b.Fatalf("framing fixture result has unexpected size or directive classification: native=%d framed=%d", len(fixture.native), len(framed))
|
||||
}
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
performanceFramedBytes = frameEffectiveYAML(fixture.scope, fixture.native)
|
||||
performanceFramedBytes, _ = frameEffectiveYAML(fixture.scope, fixture.native)
|
||||
}
|
||||
})
|
||||
b.Run("aggregate/"+fixture.name, func(b *testing.B) {
|
||||
|
||||
Reference in New Issue
Block a user