Skip to content

Conversation

@nohwnd
Copy link
Member

@nohwnd nohwnd commented Apr 26, 2022

Description

Improve performance of deserialization and serialization.
For serialization we save a lot of time by not serializing into JToken and then to string.

And for deserialization the biggest impact is coming from not deserializing payloads into JTokens, and not deserializing them every time we inspect the header of the message.

try
{
// {"Version":6,"MessageType":"TestExecution.GetTestRunnerProcessStartInfoForRunAll","Payload":{
if (rawMessage[2] != 'V')
Copy link
Contributor

@MarcoRossignoli MarcoRossignoli Apr 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of range check for malformed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good idea. Would you check just for length 3, or for minimal size of what we consider valid message? Or probably does not make a difference?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you only check for size 3 you will need to do a similar check for 10 and 11 later on so I would check at least this size.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am checking for minimal valid message size.

try
{
// {"Version":6,"MessageType":"TestExecution.GetTestRunnerProcessStartInfoForRunAll","Payload":{
if (rawMessage[2] != 'V')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you only check for size 3 you will need to do a similar check for 10 and 11 later on so I would check at least this size.

@ghost
Copy link

ghost commented Apr 29, 2022

CLA assistant check
All CLA requirements met.

@nohwnd nohwnd merged commit 52610b0 into microsoft:main May 2, 2022
@nohwnd nohwnd deleted the serialization-perf branch May 2, 2022 12:45
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.

4 participants