Add LIKELY and UNLIKELY hints
Doesn’t seem to affect timings in perftest on my machine, but it may help others.
This commit is contained in:
parent
82a423db7d
commit
4394b3bac7
@ -530,7 +530,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
template <unsigned parseFlags, typename InputStream, typename Handler>
|
template <unsigned parseFlags, typename InputStream, typename Handler>
|
||||||
bool IterativeParseNext(InputStream& is, Handler& handler) {
|
bool IterativeParseNext(InputStream& is, Handler& handler) {
|
||||||
while (is.Peek() != '\0') {
|
while (RAPIDJSON_LIKELY(is.Peek() != '\0')) {
|
||||||
SkipWhitespaceAndComments<parseFlags>(is);
|
SkipWhitespaceAndComments<parseFlags>(is);
|
||||||
|
|
||||||
Token t = Tokenize(is.Peek());
|
Token t = Tokenize(is.Peek());
|
||||||
@ -538,7 +538,7 @@ public:
|
|||||||
IterativeParsingState d = Transit<parseFlags>(state_, t, n, is, handler);
|
IterativeParsingState d = Transit<parseFlags>(state_, t, n, is, handler);
|
||||||
|
|
||||||
// If we've finished or hit an error...
|
// If we've finished or hit an error...
|
||||||
if (IsIterativeParsingCompleteState(d)) {
|
if (RAPIDJSON_UNLIKELY(IsIterativeParsingCompleteState(d))) {
|
||||||
// Report errors.
|
// Report errors.
|
||||||
if (d == IterativeParsingErrorState) {
|
if (d == IterativeParsingErrorState) {
|
||||||
HandleError(state_, is);
|
HandleError(state_, is);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user