optimize whitespace checking for gcc optimization - json2tsv - JSON to TSV converter
(HTM) git clone git://git.codemadness.org/json2tsv
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit b780768500f3466bea0d2f770fc379eb9cb78669
(DIR) parent e49c809209014c1ab4e7c6b0921d82a5cbae5feb
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 23 Oct 2019 21:39:49 +0200
optimize whitespace checking for gcc optimization
Restores some performance. no difference for clang.
gcc 4.2.1
clang 8.0.1
Diffstat:
M json.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
(DIR) diff --git a/json.c b/json.c
@@ -109,7 +109,7 @@ handlechr:
break;
/* skip JSON white-space, (NOTE: no \v, \f, \b etc) */
- if (c && strchr(" \t\n\r", c))
+ if (c == ' ' || c == '\t' || c == '\n' || c == '\r')
continue;
if (!c || !strchr(expect, c))