go-json
go-json copied to clipboard
Fix: Switch to lazy init() in decoder and encoder
Why
See: https://github.com/grafana/grafana/pull/78651
There is additional memory overhead in Grafana due the import of go-json in Apache Arrow. It looks like this is caused by init()
initializing global variables in the encoder and decoder.
Grafana uses Apache Arrow, but does not currently use Arrow's JSON encoding/decoding features, so it would be ideal if we could avoid the additional memory overhead until JSON encoding/decoding is used.
What
Switch to lazy initialization of global variables in decoder and encoder.
@goccy i apologize for pinging you directly, but could you take a quick look at this one when you have a chance?