qlik-oss / enigma-go

Go library for consuming Qlik's Associative Engine.
MIT License
39 stars 12 forks source link

fix: Use strconv in custom float unmarshalling #227

Closed glooms closed 2 years ago

glooms commented 2 years ago

This improve the performance of the custom float unmarshalling slightly compared to the goccy/go-json package. On my machine:

(goccy)

> go test -bench=FloatUnmarshal -benchtime 60s
websocket: close 1000 (normal)goos: linux
goarch: amd64
pkg: github.com/qlik-oss/enigma-go/v3
cpu: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
BenchmarkFloatUnmarshal-12      304858903              237.8 ns/op
PASS
ok      github.com/qlik-oss/enigma-go/v3        96.879s

(strconv)

go test -bench=FloatUnmarshal -benchtime 60s
websocket: close 1000 (normal)goos: linux
goarch: amd64
pkg: github.com/qlik-oss/enigma-go/v3
cpu: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
BenchmarkFloatUnmarshal-12      343606368              209.1 ns/op
PASS
ok      github.com/qlik-oss/enigma-go/v3        93.551s

The improvements are slight but it might still be worth it if float-unmarshalling is a bottleneck.