summaryrefslogtreecommitdiff
path: root/compat/json/borrowed_bench_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'compat/json/borrowed_bench_test.go')
-rw-r--r--compat/json/borrowed_bench_test.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/compat/json/borrowed_bench_test.go b/compat/json/borrowed_bench_test.go
index e2d74ab..443a13d 100644
--- a/compat/json/borrowed_bench_test.go
+++ b/compat/json/borrowed_bench_test.go
@@ -15,9 +15,13 @@ package json
import (
"bytes"
"compress/gzip"
+ "fmt"
"io"
"os"
+ "reflect"
+ "runtime"
"strings"
+ "sync"
"testing"
)
@@ -325,11 +329,10 @@ func BenchmarkUnmapped(b *testing.B) {
})
}
-/* // MODIFIED: we don't have a cache
func BenchmarkTypeFieldsCache(b *testing.B) {
b.ReportAllocs()
var maxTypes int = 1e6
- if testenv.Builder() != "" {
+ if false { // testenv.Builder() != "" { // MODIFIED: disabled
maxTypes = 1e3 // restrict cache sizes on builders
}
@@ -345,9 +348,9 @@ func BenchmarkTypeFieldsCache(b *testing.B) {
}
// clearClear clears the cache. Other JSON operations, must not be running.
- clearCache := func() {
- fieldCache = sync.Map{}
- }
+ // clearCache := func() { // MODIFIED: use function from compat_test.go
+ // fieldCache = sync.Map{} // MODIFIED: use function from compat_test.go
+ // } // MODIFIED: use function from compat_test.go
// MissTypes tests the performance of repeated cache misses.
// This measures the time to rebuild a cache of size nt.
@@ -389,7 +392,6 @@ func BenchmarkTypeFieldsCache(b *testing.B) {
})
}
}
-*/ // MODIFIED: we don't have a cache
func BenchmarkEncodeMarshaler(b *testing.B) {
b.ReportAllocs()