Simplify JsonStreamReader
by always collecting string and number values in Vec
/ String
#32
Labels
enhancement
New feature or request
internal
Issue or pull request which is internal and has no user-visible effect
performance
Problem with performance or suggestion for performance improvement
Problem solved by the enhancement
The current
JsonStreamReader
implementation tries to serve string and number values from the reader buffer, and only if that is not possibly (e.g. in case of escape sequences) falls back to collecting the value in aVec
(seeJsonStreamReader::value_bytes_buf
).Enhancement description
Consider always collecting the value in a
Vec
/String
and then depending on whether a borrowed or owned string is requested, either return a reference to this buffer, or replace the buffer with an empty one and return it (maybe shrinking / copying it in case its capacity is extremely larger than its length).This would have the advantage that it will simplify the
JsonStreamReader
implementation, and possibly also allows removing the JSON reader data buffer and only relying on the underlying reader for buffering, if desired (see also #19 (comment)).However, it has to be checked if the performance is noticeably negatively affected by this approach.
The text was updated successfully, but these errors were encountered: