-
Notifications
You must be signed in to change notification settings - Fork 330
Perf improvements in Current MDS code #2672
-
Starting this thread to point out some areas where we can benefit from perf improvement.
I will start a comment for every code spot, and we can discuss on those threads individually.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments 2 replies
-
cc @Wraith2
Beta Was this translation helpful? Give feedback.
All reactions
-
The write string tries to write to the output buffer directly if there is space available.
This is used for sending large XML files also.
This means that we will always allocate a buffer if the size of outgoing string is > packet size.
Beta Was this translation helpful? Give feedback.
All reactions
-
I haven't benchmarked this yet.
However for XML chunked writing is supported.
using (ConstrainedTextWriter writer = new ConstrainedTextWriter(new StreamWriter(new TdsOutputStream(this, stateObj, preambleToSkip), encoding), size))
Beta Was this translation helpful? Give feedback.
All reactions
-
The text writer can write chunked text, and adheres to PLP chunking in TDS protocol. However that is not the necessary solution. If we could use the Unicode encoded string to write to the output buffer directly in chunks rather than allocating the full buffer, that would be a simpler and less disruptive change. However I haven't explored the APIs enough to conclude that this is a viable path or not.
We will definitely need something similar for JSON as well. The JSON string will be sent as UTF8. So pre-calculating the length is not going to work, since UTF8 has varying length characters.
Beta Was this translation helpful? Give feedback.