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.
Fixes #31 Optimize integer-to-string conversion in GenericWriter
In the beginning, some tests are written in
misctest.cpp
. And the performance is nearly the same to the other thirdparty implementations. However, it is quite difficult to further develop and optimize, so I created a side project https://github.com/miloyip/itoa-benchmark .Currently RapidJSON adopt the
branchlut
implementation. However, it may subject to be changed in future if better algorithm is developed. The API is very simple. It can be replaced by other implementation easily.Full specialization of Writer for
StringBuffer
is added. AdditionalPush()
andPop()
member functions are added forStringBuffer
in order to prevent memory copying.PerfTest results are not obvious because the sample JSON do not contain a lot of integers.
https://gist.github.com/miloyip/1326371e39652acf21d5
However, when just using
Writer::WriteXXX()
, the results are obvious:Writer
is the new implementation.Writer1
is the original naive implementation.However, these performance tests are not rigorous enough. I would like to create a native json benchmark project in the future.