Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Switch to lazy init() in decoder and encoder #490

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

toddtreece
Copy link

@toddtreece toddtreece commented Dec 19, 2023

Why

See: grafana/grafana#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.

@toddtreece
Copy link
Author

@goccy i apologize for pinging you directly, but could you take a quick look at this one when you have a chance?

This will prevent go-json from consuming heap unless it is used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant