1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
package benchmarks
import (
"encoding/json"
"testing"
"github.com/francoispqt/gojay"
)
var bigf = []byte(`0.00058273999999999999`)
// BenchmarkBigFloatEncodingJSON decodes a big float with the standard package
func BenchmarkBigFloatEncodingJSON(b *testing.B) {
b.ReportAllocs()
for n := 0; n < b.N; n++ {
var f float64
var _ = json.Unmarshal(bigf, &f)
}
}
// BenchmarkBigFloatGojay decodes a big float with gojay
func BenchmarkBigFloatGojay(b *testing.B) {
b.ReportAllocs()
for n := 0; n < b.N; n++ {
var f float64
var _ = gojay.Unmarshal(bigf, &f)
}
}
|