micro-optimization, 1-7% faster - 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 111c9cc55cbabc01fa14e8b7694be0ef940d1702
(DIR) parent c6b45090c8319714795a2024a1282a3273f08101
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 5 Oct 2019 21:44:48 +0200
micro-optimization, 1-7% faster
compiled with various optimization flags on gcc and clang
Diffstat:
M json2tsv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/json2tsv.c b/json2tsv.c
@@ -112,7 +112,8 @@ parsejson(void (*cb)(struct json_node *, size_t, const char *))
nodes[0].name[0] = '\0';
while ((c = GETNEXT()) != EOF) {
- if (isspace(c) || iscntrl(c))
+ /* not whitespace or control-character */
+ if (c <= 0x20 || c == 0x7f)
continue;
switch (c) {