fix performance regression in the agent exporter #1119
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fix performance regression in the agent exporter.
Motivation
Several performance issues were reported since the release of 0.19.0 which included a new custom msgpack encoder. I wasn't able to pinpoint exactly where the issue comes from since it looks like v8 is not properly optimizing this part of the code. To be safe, I reimplemented the 0.4 endpoint encoder with notepack pretty much as is, which is several times faster than msgpack-lite that was used in the past, so we still get better performance without custom code. For the 0.5 endpoint encoder, there is a lot more custom code but it's taken directly from notepack with minimal changes. The idea is that the closer our custom code is to a proven library, the less chances of introducing a regression.