Skip to content

Commit ef89f9c

Browse files
committed
add oboe, map-filter-reduce, update deps
1 parent 89f2f41 commit ef89f9c

File tree

10 files changed

+651
-2866
lines changed

10 files changed

+651
-2866
lines changed

README.md

Lines changed: 85 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
# Json Querying Performance Testing
22

3-
This repo is used to test the performance of json querying npm packages. The dataset used is [City Lots San
4-
Francisco in .json](https://github.com/zemirco/sf-city-lots-json). The three libraries tested are:
3+
This repo is used to test the performance of json querying npm packages. The dataset used is [City Lots San Francisco in .json](https://github.com/zemirco/sf-city-lots-json).
4+
The libraries tested are:
55

6-
- [json-query](https://www.npmjs.com/package/json-query) [![npm](https://img.shields.io/npm/dw/json-query.svg)](https://www.npmjs.com/package/json-query)
7-
- [jsonpath-plus](https://www.npmjs.com/package/jsonpath-plus) [![npm](https://img.shields.io/npm/dw/jsonpath-plus.svg)](https://www.npmjs.com/package/jsonpath-plus)
8-
- [jsonpath](https://www.npmjs.com/package/jsonpath) [![npm](https://img.shields.io/npm/dw/jsonpath.svg)](https://www.npmjs.com/package/jsonpath)
9-
- [JSONStream](https://www.npmjs.com/package/JSONStream) [![npm](https://img.shields.io/npm/dw/JSONStream.svg)](https://www.npmjs.com/package/JSONStream)
6+
| Package | NPM Downloads | Last commit |
7+
| :-- | :-- | :-- |
8+
| [json-query](https://www.npmjs.com/package/json-query) | [![npm](https://img.shields.io/npm/dw/json-query.svg)](https://www.npmjs.com/package/json-query) | ![GitHub last commit](https://img.shields.io/github/last-commit/mmckegg/json-query.svg) |
9+
| [jsonpath-plus](https://www.npmjs.com/package/jsonpath-plus) | [![npm](https://img.shields.io/npm/dw/jsonpath-plus.svg)](https://www.npmjs.com/package/jsonpath-plus) | ![GitHub last commit](https://img.shields.io/github/last-commit/s3u/JSONPath.svg) |
10+
| [jsonpath](https://www.npmjs.com/package/jsonpath) | [![npm](https://img.shields.io/npm/dw/jsonpath.svg)](https://www.npmjs.com/package/jsonpath) | ![GitHub last commit](https://img.shields.io/github/last-commit/dchester/jsonpath.svg) |
11+
| [JSONStream](https://www.npmjs.com/package/JSONStream) | [![npm](https://img.shields.io/npm/dw/JSONStream.svg)](https://www.npmjs.com/package/JSONStream) | ![GitHub last commit](https://img.shields.io/github/last-commit/dominictarr/JSONStream.svg) |
12+
| [oboe](https://www.npmjs.com/package/oboe) | [![npm](https://img.shields.io/npm/dw/oboe.svg)](https://www.npmjs.com/package/oboe) | ![GitHub last commit](https://img.shields.io/github/last-commit/jimhigson/oboe.js.svg) |
13+
| [map-filter-reduce](https://www.npmjs.com/package/map-filter-reduce) | [![npm](https://img.shields.io/npm/dw/map-filter-reduce.svg)](https://www.npmjs.com/package/map-filter-reduce) | ![GitHub last commit](https://img.shields.io/github/last-commit/dominictarr/map-filter-reduce.svg) |
1014

11-
`jsonpath-plus` and `jsonpath` use the [XPath for Json Specification](https://goessner.net/articles/JsonPath),
12-
while `json-query` has its own custom DSL.
15+
`jsonpath-plus` and `jsonpath` use the [XPath for Json Specification](https://goessner.net/articles/JsonPath).
16+
`json-query` has its own custom DSL. `JSONStream`, `oboe`, and `map-filter-reduce` are streaming libraries, though I've had varying success in making them anywhere near as performant.
1317

1418
## How to run
1519

@@ -44,89 +48,102 @@ largeCityLots 206560 items.
4448
4549
smallCityLots:
4650
- json-query:
47-
- shallow took 0.0329 seconds.
48-
- deep took 0.0495 seconds.
49-
- conditional took 0.0455 seconds.
51+
- shallow took 0.0176 seconds.
52+
- deep took 0.0502 seconds.
53+
- conditional took 0.0408 seconds.
5054
- jsonpath-plus:
51-
- shallow took 0.3907 seconds.
52-
- deep took 0.3808 seconds.
53-
- conditional took 0.3051 seconds.
55+
- shallow took 0.4146 seconds.
56+
- deep took 0.4239 seconds.
57+
- conditional took 0.326 seconds.
5458
- jsonpath:
55-
- shallow took 1.0639 seconds.
56-
- deep took 6.0417 seconds.
57-
- conditional took 0.0285 seconds.
59+
- shallow took 1.1165 seconds.
60+
- deep took 4.4373 seconds.
61+
- conditional took 0.1387 seconds.
5862
- JSONStream:
59-
- shallow took 2.4209 seconds.
60-
- deep took 2.4758 seconds.
61-
- conditional took 2.0678 seconds.
62-
JSONStream conditional AssertError: result should have length 643 but instead is 0
63+
- shallow took 20.5 seconds.
64+
- deep took 23.5372 seconds.
65+
- oboe:
66+
- shallow took 25.0891 seconds.
67+
- deep took 32.5883 seconds.
68+
- map-filter-reduce:
6369
6470
mediumCityLots:
6571
- json-query:
66-
- shallow took 0.0416 seconds.
67-
- deep took 0.0743 seconds.
68-
- conditional took 0.0491 seconds.
72+
- shallow took 0.0489 seconds.
73+
- deep took 0.0732 seconds.
74+
- conditional took 0.0488 seconds.
6975
- jsonpath-plus:
70-
- shallow took 0.7514 seconds.
71-
- deep took 0.8055 seconds.
72-
- conditional took 0.6247 seconds.
76+
- shallow took 0.8285 seconds.
77+
- deep took 0.8567 seconds.
78+
- conditional took 0.6074 seconds.
7379
- jsonpath:
74-
- shallow took 2.231 seconds.
75-
- deep took 36.6839 seconds.
76-
- conditional took 0.0478 seconds.
80+
- shallow took 2.2047 seconds.
81+
- deep took 37.187 seconds.
82+
- conditional took 0.2852 seconds.
7783
- JSONStream:
78-
- shallow took 4.8281 seconds.
79-
- deep took 5.4624 seconds.
80-
- conditional took 4.0842 seconds.
81-
JSONStream conditional AssertError: result should have length 824 but instead is 0
84+
- shallow took 199.4793 seconds.
85+
- deep took 5.0332 seconds.
86+
- oboe:
87+
- shallow took 27.819 seconds.
88+
- deep took 77.9259 seconds.
89+
- map-filter-reduce:
8290
8391
largeCityLots:
8492
- json-query:
8593
json-query shallow failed, RangeError: Maximum call stack size exceeded.
8694
json-query deep failed, RangeError: Maximum call stack size exceeded.
8795
json-query conditional failed, RangeError: Maximum call stack size exceeded.
8896
- jsonpath-plus:
89-
- shallow took 2.0191 seconds.
90-
- deep took 2.0583 seconds.
91-
- conditional took 1.1441 seconds.
97+
- shallow took 2.3345 seconds.
98+
- deep took 2.472 seconds.
99+
- conditional took 3.1351 seconds.
92100
- jsonpath:
93-
- shallow took 5.9584 seconds.
94-
- deep took 180.8738 seconds.
95-
- conditional took 0.1097 seconds.
101+
- shallow took 8.509 seconds.
102+
- deep took 252.9623 seconds.
103+
- conditional took 0.7586 seconds.
96104
- JSONStream:
97-
- shallow took 16.0752 seconds.
98-
- deep took 16.9739 seconds.
99-
- conditional took 14.3877 seconds.
100-
JSONStream conditional AssertError: result should have length 2843 but instead is 0
105+
- shallow took 54.8295 seconds.
106+
- deep took 146.2962 seconds.
107+
- oboe:
108+
- shallow took 148.8824 seconds.
109+
- deep took 216.7555 seconds.
110+
- map-filter-reduce:
111+
101112
102113
103114
summary:
104115
105116
smallCityLots
106-
┌───────────────┬─────────┬────────┬─────────────┐
107-
│ (index) │ shallow │ deep │ conditional │
108-
├───────────────┼─────────┼────────┼─────────────┤
109-
│ json-query │ 0.0329 │ 0.0495 │ 0.0455 │
110-
│ jsonpath-plus │ 0.3907 │ 0.3808 │ 0.3051 │
111-
│ jsonpath │ 1.0639 │ 6.0417 │ 0.0285 │
112-
│ JSONStream │ 2.4209 │ 2.4758 │ 'incorrect' │
113-
└───────────────┴─────────┴────────┴─────────────┘
117+
┌───────────────────┬───────────────────┬───────────────────┬───────────────────┐
118+
│ (index) │ shallow │ deep │ conditional │
119+
├───────────────────┼───────────────────┼───────────────────┼───────────────────┤
120+
│ json-query │ 0.0176 │ 0.0502 │ 0.0408 │
121+
│ jsonpath-plus │ 0.4146 │ 0.4239 │ 0.326 │
122+
│ jsonpath │ 1.1165 │ 4.4373 │ 0.1387 │
123+
│ JSONStream │ 20.5 │ 23.5372 │ 'not possible' │
124+
│ oboe │ 25.0891 │ 32.5883 │ 'not possible' │
125+
│ map-filter-reduce │ 'not implemented' │ 'not implemented' │ 'not implemented' │
126+
└───────────────────┴───────────────────┴───────────────────┴───────────────────┘
114127
mediumCityLots
115-
┌───────────────┬─────────┬─────────┬─────────────┐
116-
│ (index) │ shallow │ deep │ conditional │
117-
├───────────────┼─────────┼─────────┼─────────────┤
118-
│ json-query │ 0.0416 │ 0.0743 │ 0.0491 │
119-
│ jsonpath-plus │ 0.7514 │ 0.8055 │ 0.6247 │
120-
│ jsonpath │ 2.231 │ 36.6839 │ 0.0478 │
121-
│ JSONStream │ 4.8281 │ 5.4624 │ 'incorrect' │
122-
└───────────────┴─────────┴─────────┴─────────────┘
128+
┌───────────────────┬───────────────────┬───────────────────┬───────────────────┐
129+
│ (index) │ shallow │ deep │ conditional │
130+
├───────────────────┼───────────────────┼───────────────────┼───────────────────┤
131+
│ json-query │ 0.0489 │ 0.0732 │ 0.0488 │
132+
│ jsonpath-plus │ 0.8285 │ 0.8567 │ 0.6074 │
133+
│ jsonpath │ 2.2047 │ 37.187 │ 0.2852 │
134+
│ JSONStream │ 199.4793 │ 5.0332 │ 'not possible' │
135+
│ oboe │ 27.819 │ 77.9259 │ 'not possible' │
136+
│ map-filter-reduce │ 'not implemented' │ 'not implemented' │ 'not implemented' │
137+
└───────────────────┴───────────────────┴───────────────────┴───────────────────┘
123138
largeCityLots
124-
┌───────────────┬──────────┬──────────┬─────────────┐
125-
│ (index) │ shallow │ deep │ conditional │
126-
├───────────────┼──────────┼──────────┼─────────────┤
127-
│ json-query │ 'failed' │ 'failed' │ 'failed' │
128-
│ jsonpath-plus │ 2.0191 │ 2.0583 │ 1.1441 │
129-
│ jsonpath │ 5.9584 │ 180.8738 │ 0.1097 │
130-
│ JSONStream │ 16.0752 │ 16.9739 │ 'incorrect' │
131-
└───────────────┴──────────┴──────────┴─────────────┘
139+
┌───────────────────┬───────────────────┬───────────────────┬───────────────────┐
140+
│ (index) │ shallow │ deep │ conditional │
141+
├───────────────────┼───────────────────┼───────────────────┼───────────────────┤
142+
│ json-query │ 'failed' │ 'failed' │ 'failed' │
143+
│ jsonpath-plus │ 2.3345 │ 2.472 │ 3.1351 │
144+
│ jsonpath │ 8.509 │ 252.9623 │ 0.7586 │
145+
│ JSONStream │ 54.8295 │ 146.2962 │ 'not possible' │
146+
│ oboe │ 148.8824 │ 216.7555 │ 'not possible' │
147+
│ map-filter-reduce │ 'not implemented' │ 'not implemented' │ 'not implemented' │
148+
└───────────────────┴───────────────────┴───────────────────┴───────────────────┘
132149
```

0 commit comments

Comments
 (0)