* JSON errors are now labelled with JSON and not XML

* Fixed: [Performance issue when parsing large JSON param](https://github.com/clicon/clixon/issues/266)
* Moved strlen() from for end condition
* Fixed debugging of xpath parser
This commit is contained in:
Olof hagsand 2021-09-20 20:30:56 +02:00
parent 3cd3f7987d
commit 392e6679c5
17 changed files with 166 additions and 89 deletions

33
test/test_perf_json.sh Executable file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env bash
# JSON performance test:
# 1. parse a long string
# Magic line must be first in script (see README.md)
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
: ${clixon_util_json:="clixon_util_json"}
# Number of list/leaf-list entries in file
: ${perfnr:=20000}
fjson=$dir/long.json
new "generate long file $fjson"
echo -n '{"foo": "' > $fjson
for (( i=0; i<$perfnr; i++ )); do
echo -n "a" >> $fjson
done
echo '"}' >> $fjson
echo "$fjson"
new "json parse long string"
expecteof_file "time -p $clixon_util_json" 0 "$fjson" 2>&1 | awk '/real/ {print $2}'
rm -rf $dir
# unset conditional parameters
unset clixon_util_xml
unset perfnr
new "endtest"
endtest