This repository was archived by the owner on Aug 2, 2023. It is now read-only.
Update JsonWriter performance tests and add more unit tests.#2293
Merged
Conversation
adamsitnik
approved these changes
May 16, 2018
Member
adamsitnik
left a comment
There was a problem hiding this comment.
LGTM!
I saw the that the unit tests are called "basic" and you don't check for edge case support.
I assume that you plan to do this in the future, so please don't forget to check some edge cases (like a string containing ",", nested json etc). I wonder how handling such edge cases is going to affect the performance.
| _stringBuilder.Clear(); | ||
| writer = new StringWriter(_stringBuilder); | ||
| } | ||
| WriterNewtonsoftHelloWorld(Formatted, writer); |
Member
There was a problem hiding this comment.
Could you please move the duplicated code to a helper methd?
TextWriter writer;
if (IsUTF8Encoded)
{
_memoryStream.Seek(0, SeekOrigin.Begin);
writer = _streamWriter;
}
else
{
_stringBuilder.Clear();
writer = new StringWriter(_stringBuilder);
}
Contributor
Author
There was a problem hiding this comment.
Good call, will do.
| _symbolTable = GetTargetEncoder(Target); | ||
| _arrayFormatter = new ArrayFormatter(BufferSize, _symbolTable); | ||
| _data = new int[ExtraArraySize]; | ||
| Random rand = new Random(42); |
Member
There was a problem hiding this comment.
good idea to create Random with constant seed! 👍
…ateJsonWriterTests
Contributor
Author
|
@dotnet-bot test this please |
1 similar comment
Contributor
Author
|
@dotnet-bot test this please |
Contributor
Author
|
@dotnet-bot test Innerloop Ubuntu16.04 Debug Build and Test |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
[WIP] Depends on #2292 (where we split the types) for CI to be green.