-
Notifications
You must be signed in to change notification settings - Fork 1.6k
X Experimental Benchmarks
This page describes some benchmarks and gives some representative timings and "maxrss" (maximum resident set size) statistics.
Each "test" consists of a combination of input data (possibly null) and a program, normally a jq program. The first test however involves the md5 program, first so that the md5 value of a particular JSON file can be shown, and to give a reference point for comparison.
Each combination of input data and program is assigned a number, given in the form (N); for example, the first "test" is:
(1) md5 jeopardy.json
This page is organized as follows:
-
the SOURCES sections has one subsection each for DATA and for PROGRAMS;
-
the RESULTS section is organized into GROUPS so that the timings within each group are roughly comparable. Groups are identified by a string such as "Mac OS X (High Sierra) 3GHz 16GB RAM"
In the RESULTS section, the version of jq should be specified according to its tag, e.g. jq-1.5, jq-1.6rc1
"jeopardy.json" (aka JEOPARDY_QUESTIONS1.json)
- https://github.com/alicemaz/super_jeopardy/blob/master/JEOPARDY_QUESTIONS1.json
- https://web.archive.org/web/20180222052746/https://raw.githubusercontent.com/alicemaz/super_jeopardy/master/JEOPARDY_QUESTIONS1.json
- https://drive.google.com/file/d/0BwT5wj_P7BKXb2hfM3d2RHU1ckE/
- https://gist.github.com/pkoppstein/a5abb4ebef3b0f72a6ed Note: in the tests, the last line of "schema.jq" has been uncommented, but see footnote [*1] below for alternatives.
def zip(headers):
. headers as $headers
| [$headers, .] | transpose | map({(.[0]): .[1]}) | add ;
def testzip(n):
[range(0;n)] as $row
| $row | zip( $row|map(tostring) ) ;
testzip(1000000) | length
(1) md5 jeopardy.json
MD5 (jeopardy.json) = 2075398fa049b1c00223b2279ca5281d
user 0m0.126s
sys 0m0.025s
maxrss 11341824
(2) length jeopardy.json
jq-1.5 length jeopardy.json
216930
user 0m1.144s
sys 0m0.112s
maxrss 223440896
(3) schema.jq jeopardy.json
jq-1.5 -f schema.jq jeopardy.json > jeopardy.schema.json
user 7.10s
sys 0.13s
maxrss 223457280
(3) schema.jq jeopardy.json
jq-1.6rc1 -f schema.jq jeopardy.json > jeopardy.schema.json
user 8.26s
sys 0.13s
maxrss 223526912
(4) null testzip.jq
jq-1.5 -n testzip.jq
1000000
user 6.11s
sys 0.35s
maxrss 711286784
APPENDIX 1: Output
"jeopardy.schema.json"
{
"air_date": "string",
"answer": "string",
"category": "string",
"question": "string",
"round": "string",
"show_number": "string",
"value": "string"
}
[*1] If you prefer to use schema.jq as it exists on the web, here are two alternative methods that can be considered:
(a) jq -f <(cat schema.jq; echo schema) ... (b) jq 'include "schema"; schema' ...
For further details about using include
, see the jq documentation.
- Home
- FAQ
- jq Language Description
- Cookbook
- Modules
- Parsing Expression Grammars
- Docs for Oniguruma Regular Expressions (RE.txt)
- Advanced Topics
- Guide for Contributors
- How To
- C API
- jq Internals
- Tips
- Development