From 666ea93dba377f267a2c8ecf97378a420db18383 Mon Sep 17 00:00:00 2001 From: Adam Scarr Date: Sun, 6 Aug 2017 23:32:10 +1000 Subject: Eliminate a bunch of allocations --- json/profile/json.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'json/profile/json.go') diff --git a/json/profile/json.go b/json/profile/json.go index b94848b..a03d047 100644 --- a/json/profile/json.go +++ b/json/profile/json.go @@ -31,11 +31,13 @@ func main() { } }() } + max := 1000000 if *memprofile != "" { runtime.MemProfileRate = 1 + max = 10000 } - for i := 0; i < 10000; i++ { + for i := 0; i < max; i++ { _, err := json.Unmarshal(`{"true":true, "false":false, "null": null}`) if err != nil { panic(err) -- cgit v1.2.3