-
Notifications
You must be signed in to change notification settings - Fork 296
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
[Exporter.Geneva] Avoid allocation when serializing scopes #433
[Exporter.Geneva] Avoid allocation when serializing scopes #433
Conversation
Codecov Report
@@ Coverage Diff @@
## main #433 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 163 167 +4
Lines 4983 5403 +420
======================================
- Misses 4983 5403 +420
|
internal ushort ScopeDepth; | ||
internal int IndexForArrayLength; | ||
internal int Cursor; | ||
internal byte[] Buffer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you made this...
internal byte[] Buffer = new byte[BUFFER_SIZE];
You could probably get rid of...
private static readonly ThreadLocal<byte[]> m_buffer = new ThreadLocal<byte[]>(() => null);
...and just use exporterState
for everything the exporter needs on a thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
{ | ||
state.Cursor = MessagePackSerializer.SerializeAsciiString(state.Buffer, state.Cursor, "scopes"); | ||
state.Cursor = MessagePackSerializer.WriteArrayHeader(state.Buffer, state.Cursor, ushort.MaxValue); | ||
state.IndexForArrayLength = state.Cursor - 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this line is moved up one then the - 2
is not needed right?
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Fixes #391
Changes