diff options
author | Adam Scarr <adam@vektah.net> | 2017-08-06 23:32:10 +1000 |
---|---|---|
committer | Adam Scarr <adam@vektah.net> | 2017-08-06 23:32:10 +1000 |
commit | 666ea93dba377f267a2c8ecf97378a420db18383 (patch) | |
tree | 5efee0b6e4ccf44b854d9bb65e4e6fa5e7f86548 /json/profile/json.go | |
parent | 9d7779e8ca5404f26abbd8cce0314d9cee967bba (diff) |
Eliminate a bunch of allocations
Diffstat (limited to 'json/profile/json.go')
-rw-r--r-- | json/profile/json.go | 4 |
1 files changed, 3 insertions, 1 deletions
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) |