Skip to content

Updated queriers and added js-json-go #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 70 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ The libraries tested are:
| [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) |
| [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) |
| [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) |
| [js-json-go](https://www.npmjs.com/package/js-json-go) | [![npm](https://img.shields.io/npm/dw/js-json-go.svg)](https://www.npmjs.com/package/jg-json-go) | ![GitHub last commit](https://img.shields.io/github/last-commit/JG-1202/js-json-go.svg) |
| [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) |
| [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) |
| [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) |

`jsonpath-plus` and `jsonpath` use the [XPath for Json Specification](https://goessner.net/articles/JsonPath).
`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.
`json-query` and `js-json-go` have 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.

## How to run

Expand All @@ -34,12 +35,12 @@ The performance test runs three queries on each of the libraries. All three quer

### Results

Ran using Macbook Pro, 2.2 GHz Intel Core i7, 16 GB 2400 MHz DDR4
Ran using Macbook Pro, 2,9 GHz Dual-Core Intel Core i5, 8 GB 2133 MHz LPDDR3

```
$ npm run perf

> [email protected].0 perf /Users/andrew/Code/scratchwork/perf-json-querying
> [email protected].1 perf /Users/user/json-querying-performance-testing-master
> node --max-old-space-size=4096 src

smallCityLots 49998 items.
Expand All @@ -48,44 +49,52 @@ largeCityLots 206560 items.

smallCityLots:
- json-query:
- shallow took 0.0176 seconds.
- deep took 0.0502 seconds.
- conditional took 0.0408 seconds.
- shallow took 0.0146 seconds.
- deep took 0.0326 seconds.
- conditional took 0.023 seconds.
- jsonpath-plus:
- shallow took 0.4146 seconds.
- deep took 0.4239 seconds.
- conditional took 0.326 seconds.
- shallow took 0.4832 seconds.
- deep took 0.4658 seconds.
- conditional took 0.3347 seconds.
- jsonpath:
- shallow took 1.1165 seconds.
- deep took 4.4373 seconds.
- conditional took 0.1387 seconds.
- shallow took 1.094 seconds.
- deep took 8.6515 seconds.
- conditional took 0.0299 seconds.
- js-json-go:
- shallow took 0.0256 seconds.
- deep took 0.0398 seconds.
- conditional took 0.1533 seconds.
- JSONStream:
- shallow took 20.5 seconds.
- deep took 23.5372 seconds.
- shallow took 3.0701 seconds.
- deep took 3.2552 seconds.
- oboe:
- shallow took 25.0891 seconds.
- deep took 32.5883 seconds.
- shallow took 3.898 seconds.
- deep took 4.1545 seconds.
- map-filter-reduce:

mediumCityLots:
- json-query:
- shallow took 0.0489 seconds.
- deep took 0.0732 seconds.
- conditional took 0.0488 seconds.
- shallow took 0.0773 seconds.
- deep took 0.092 seconds.
- conditional took 0.0358 seconds.
- jsonpath-plus:
- shallow took 0.8285 seconds.
- deep took 0.8567 seconds.
- conditional took 0.6074 seconds.
- shallow took 0.9456 seconds.
- deep took 0.9424 seconds.
- conditional took 0.677 seconds.
- jsonpath:
- shallow took 2.2047 seconds.
- deep took 37.187 seconds.
- conditional took 0.2852 seconds.
- shallow took 2.2628 seconds.
- deep took 37.9562 seconds.
- conditional took 0.0533 seconds.
- js-json-go:
- shallow took 0.0503 seconds.
- deep took 0.0466 seconds.
- conditional took 0.218 seconds.
- JSONStream:
- shallow took 199.4793 seconds.
- deep took 5.0332 seconds.
- shallow took 5.4356 seconds.
- deep took 6.2937 seconds.
- oboe:
- shallow took 27.819 seconds.
- deep took 77.9259 seconds.
- shallow took 8.3065 seconds.
- deep took 8.7172 seconds.
- map-filter-reduce:

largeCityLots:
Expand All @@ -94,19 +103,23 @@ json-query shallow failed, RangeError: Maximum call stack size exceeded.
json-query deep failed, RangeError: Maximum call stack size exceeded.
json-query conditional failed, RangeError: Maximum call stack size exceeded.
- jsonpath-plus:
- shallow took 2.3345 seconds.
- deep took 2.472 seconds.
- conditional took 3.1351 seconds.
- shallow took 2.6208 seconds.
- deep took 2.7371 seconds.
- conditional took 1.4626 seconds.
- jsonpath:
- shallow took 8.509 seconds.
- deep took 252.9623 seconds.
- conditional took 0.7586 seconds.
- shallow took 7.0133 seconds.
- deep took 166.297 seconds.
- conditional took 0.1198 seconds.
- js-json-go:
- shallow took 0.0926 seconds.
- deep took 0.0784 seconds.
- conditional took 0.443 seconds.
- JSONStream:
- shallow took 54.8295 seconds.
- deep took 146.2962 seconds.
- shallow took 16.8393 seconds.
- deep took 17.5634 seconds.
- oboe:
- shallow took 148.8824 seconds.
- deep took 216.7555 seconds.
- shallow took 21.9919 seconds.
- deep took 27.0612 seconds.
- map-filter-reduce:


Expand All @@ -117,33 +130,36 @@ smallCityLots
┌───────────────────┬───────────────────┬───────────────────┬───────────────────┐
│ (index) │ shallow │ deep │ conditional │
├───────────────────┼───────────────────┼───────────────────┼───────────────────┤
│ json-query │ 0.0176 │ 0.0502 │ 0.0408 │
│ jsonpath-plus │ 0.4146 │ 0.4239 │ 0.326 │
│ jsonpath │ 1.1165 │ 4.4373 │ 0.1387 │
│ JSONStream │ 20.5 │ 23.5372 │ 'not possible' │
│ oboe │ 25.0891 │ 32.5883 │ 'not possible' │
│ json-query │ 0.0146 │ 0.0326 │ 0.023 │
│ jsonpath-plus │ 0.4832 │ 0.4658 │ 0.3347 │
│ jsonpath │ 1.094 │ 8.6515 │ 0.0299 │
│ js-json-go │ 0.0256 │ 0.0398 │ 0.1533 │
│ JSONStream │ 3.0701 │ 3.2552 │ 'not possible' │
│ oboe │ 3.898 │ 4.1545 │ 'not possible' │
│ map-filter-reduce │ 'not implemented' │ 'not implemented' │ 'not implemented' │
└───────────────────┴───────────────────┴───────────────────┴───────────────────┘
mediumCityLots
┌───────────────────┬───────────────────┬───────────────────┬───────────────────┐
│ (index) │ shallow │ deep │ conditional │
├───────────────────┼───────────────────┼───────────────────┼───────────────────┤
│ json-query │ 0.0489 │ 0.0732 │ 0.0488 │
│ jsonpath-plus │ 0.8285 │ 0.8567 │ 0.6074 │
│ jsonpath │ 2.2047 │ 37.187 │ 0.2852 │
│ JSONStream │ 199.4793 │ 5.0332 │ 'not possible' │
│ oboe │ 27.819 │ 77.9259 │ 'not possible' │
│ json-query │ 0.0773 │ 0.092 │ 0.0358 │
│ jsonpath-plus │ 0.9456 │ 0.9424 │ 0.677 │
│ jsonpath │ 2.2628 │ 37.9562 │ 0.0533 │
│ js-json-go │ 0.0503 │ 0.0466 │ 0.218 │
│ JSONStream │ 5.4356 │ 6.2937 │ 'not possible' │
│ oboe │ 8.3065 │ 8.7172 │ 'not possible' │
│ map-filter-reduce │ 'not implemented' │ 'not implemented' │ 'not implemented' │
└───────────────────┴───────────────────┴───────────────────┴───────────────────┘
largeCityLots
┌───────────────────┬───────────────────┬───────────────────┬───────────────────┐
│ (index) │ shallow │ deep │ conditional │
├───────────────────┼───────────────────┼───────────────────┼───────────────────┤
│ json-query │ 'failed' │ 'failed' │ 'failed' │
│ jsonpath-plus │ 2.3345 │ 2.472 │ 3.1351 │
│ jsonpath │ 8.509 │ 252.9623 │ 0.7586 │
│ JSONStream │ 54.8295 │ 146.2962 │ 'not possible' │
│ oboe │ 148.8824 │ 216.7555 │ 'not possible' │
│ jsonpath-plus │ 2.6208 │ 2.7371 │ 1.4626 │
│ jsonpath │ 7.0133 │ 166.297 │ 0.1198 │
│ js-json-go │ 0.0926 │ 0.0784 │ 0.443 │
│ JSONStream │ 16.8393 │ 17.5634 │ 'not possible' │
│ oboe │ 21.9919 │ 27.0612 │ 'not possible' │
│ map-filter-reduce │ 'not implemented' │ 'not implemented' │ 'not implemented' │
└───────────────────┴───────────────────┴───────────────────┴───────────────────┘
```
```
Loading