Introduction
Introduction Statistics Contact Development Disclaimer Help
json: optimize number parsing for large number datasets - json2tsv - JSON to TS…
git clone git://git.codemadness.org/json2tsv
Log
Files
Refs
README
LICENSE
---
commit 226d85203f7ea26dcc71c98e0fb7fe3ffb78176b
parent 650481927d19d28d035d470bdedd2e2226e4dbd2
Author: Hiltjo Posthuma <[email protected]>
Date: Thu, 23 Sep 2021 18:31:00 +0200
json: optimize number parsing for large number datasets
Measured on OpenBSD and Voidlinux glibc (gcc and clang).
Not much difference on AMD Ryzen with GNUVoid Linux (glibc).
Tested and much difference on OpenBSD-current (laptop, older Intel CPU), 6.8
and 6.9 (older Intel Xeons).
Tested with json-testsuite, no differences (as intended).
Diffstat:
M json.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/json.c b/json.c
@@ -291,7 +291,8 @@ escchr:
while (1) {
c = GETNEXT();
if (c == EOF ||
- !c || !strchr("0123456789eE+-.", c) ||
+ (!isdigit(c) && c != 'e' && c != 'E' &&
+ c != '+' && c != '-' && c != '.') ||
p + 1 >= sizeof(pri)) {
pri[p] = '\0';
cb(nodes, depth + 1, pri);
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.