Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Avoid String allocations when writing strings that require special character handling #1191
JsonValueUtils.WriteEscapedJsonString allocates additional strings when dealing with special characters.
OData .NET LIB
JsonValueUtils WriteEscapedJsonString uses Substrings to write strings to underlying textwriter but because of the immutable nature of .NET strings it allocates new strings. To further this, strings are objects in .NET and this makes objects visible to GC. This lead high allocations and excessive work needed by GC to clean this objects up. This can be avoided by using a buffer.