core: add msgpack encoder#1491
Merged
Kyle-Verhoog merged 27 commits intomasterfrom Jul 28, 2020
Merged
Conversation
brettlangdon
reviewed
Jun 8, 2020
59f9ff9 to
d02932b
Compare
brettlangdon
reviewed
Jun 8, 2020
Member
brettlangdon
left a comment
There was a problem hiding this comment.
👍 on most of your responses, good to keep things 100% compatible now, then we can make riskier optimizations later
d02932b to
f91972c
Compare
f91972c to
43c5875
Compare
5e58b1d to
147bf90
Compare
5e58444 to
c5c4658
Compare
f5c7c31 to
d8f2068
Compare
- remove float implementation
Member
Author
|
Was able to run the tests under Windows: @brettlangdon I think we're good for a final review 😄 |
jd
reviewed
Jul 28, 2020
brettlangdon
approved these changes
Jul 28, 2020
5 tasks
4 tasks
mergify Bot
pushed a commit
that referenced
this pull request
Nov 24, 2021
It's handy to have a general msgpack encoder that can be used for encoding arbitrary payloads of primitive Python types (see #2915). The encoder added here is based off the one added in #1491. It might be useful to use as a fallback for encoding traces as well if an issue with the custom msgpack encoder is suspected. The relevant tests from the msgpack-python implementation are included as well to ensure that the implementation is correct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
This patch introduces the following:
PackerA Cython msgpack encoder mostly derived from the official msgpack library's 0.6.2 implementation. The changes made were:
service,name,resource), etcTraceMsgPackEncoderA trace encoder using the above
Packerto encode traces.Why?
We support Python 2 but the msgpack package has dropped support for the C-extension in Python 2. Instead a pure-python fallback is used which is over an order of magnitude slower. This results in an unacceptable performance overhead to Python 2 projects using the tracer.
This also opens the door to further optimizations we can make to encoding.
Benchmarks
Python 2
We see a 23x improvement (244.49ms -> 10.35ms).
Note here that
customis the implementation added,fallbackis the default that a user would have if they installed the tracer today without specifying their own version of msgpack.Python 3
We get about a 1.4-2.0x improvement with the optimizations introduced.
Further optimizations
Outside the scope of this PR
join_encodedis actually pretty slow and can be quite easily done manuallyTODO