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

Refinery spends unnecessary 5% cpu resizing maps #749

Closed
lizthegrey opened this issue Jun 27, 2023 · 0 comments · Fixed by #754
Closed

Refinery spends unnecessary 5% cpu resizing maps #749

lizthegrey opened this issue Jun 27, 2023 · 0 comments · Fixed by #754
Labels
type: bug Something isn't working

Comments

@lizthegrey
Copy link
Member

lizthegrey commented Jun 27, 2023

EnqueueEvent winds up looping over AddField() for a total of len(ev.Data) times.

Unfortunately due to behaviour in Go runtime (see golang/go#56182) we can't resize the map once we have it (nor do we have direct access to the map from libhoney clients since it's a private and lock-protected struct field).

Thus, we need to be able to pass in len(ev.Data) to builder.NewEvent() to allow correctly pre-sizing the map where the number of fields is known, and avoiding reallocating and copying the map over and over again for 5% of time spent in all of refinery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant