Skip to content

Update tests and add json-power-query #5

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 5 commits 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
122 changes: 69 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ 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) |
| [json-power-query](https://www.npmjs.com/package/json-power-query) | [![npm](https://img.shields.io/npm/dw/json-power-query.svg)](https://www.npmjs.com/package/json-power-query) | ![GitHub last commit](https://img.shields.io/github/last-commit/TotalTechGeek/json-power-query.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) |
Expand All @@ -34,58 +35,66 @@ 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 a 4.0 GHz Intel Core i7-4790k, 16 GB 1600 MHz DDR3

```
$ npm run perf

> [email protected] perf /Users/andrew/Code/scratchwork/perf-json-querying
> node --max-old-space-size=4096 src
> [email protected] perf C:\Users\Jesse\Documents\Projects\json-querying-performance-testing
> node --max-old-space-size=4096 --expose-gc src

smallCityLots 49998 items.
mediumCityLots 99998 items.
largeCityLots 206560 items.

smallCityLots:
- json-query:
- shallow took 0.0176 seconds.
- deep took 0.0502 seconds.
- conditional took 0.0408 seconds.
- shallow took 0.0087 seconds.
- deep took 0.0136 seconds.
- conditional took 0.0213 seconds.
- jsonpath-plus:
- shallow took 0.4146 seconds.
- deep took 0.4239 seconds.
- conditional took 0.326 seconds.
- shallow took 0.3832 seconds.
- deep took 0.3916 seconds.
- conditional took 0.3685 seconds.
- jsonpath:
- shallow took 1.1165 seconds.
- deep took 4.4373 seconds.
- conditional took 0.1387 seconds.
- shallow took 0.9513 seconds.
- deep took 5.5776 seconds.
- conditional took 0.04 seconds.
- json-power-query:
- shallow took 0.0053 seconds.
- deep took 0.0057 seconds.
- conditional took 0.0077 seconds.
- JSONStream:
- shallow took 20.5 seconds.
- deep took 23.5372 seconds.
- shallow took 2.2002 seconds.
- deep took 2.2644 seconds.
- oboe:
- shallow took 25.0891 seconds.
- deep took 32.5883 seconds.
- shallow took 2.7596 seconds.
- deep took 2.8447 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.016 seconds.
- deep took 0.0309 seconds.
- conditional took 0.0255 seconds.
- jsonpath-plus:
- shallow took 0.8285 seconds.
- deep took 0.8567 seconds.
- conditional took 0.6074 seconds.
- shallow took 0.7571 seconds.
- deep took 0.8095 seconds.
- conditional took 0.6889 seconds.
- jsonpath:
- shallow took 2.2047 seconds.
- deep took 37.187 seconds.
- conditional took 0.2852 seconds.
- shallow took 1.9249 seconds.
- deep took 20.8872 seconds.
- conditional took 0.0761 seconds.
- json-power-query:
- shallow took 0.0075 seconds.
- deep took 0.01 seconds.
- conditional took 0.0087 seconds.
- JSONStream:
- shallow took 199.4793 seconds.
- deep took 5.0332 seconds.
- shallow took 4.5227 seconds.
- deep took 4.6853 seconds.
- oboe:
- shallow took 27.819 seconds.
- deep took 77.9259 seconds.
- shallow took 5.7411 seconds.
- deep took 5.9309 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 1.9852 seconds.
- deep took 2.0817 seconds.
- conditional took 1.5008 seconds.
- jsonpath:
- shallow took 8.509 seconds.
- deep took 252.9623 seconds.
- conditional took 0.7586 seconds.
- shallow took 5.4554 seconds.
- deep took 88.787 seconds.
- conditional took 0.15 seconds.
- json-power-query:
- shallow took 0.0109 seconds.
- deep took 0.0127 seconds.
- conditional took 0.0143 seconds.
- JSONStream:
- shallow took 54.8295 seconds.
- deep took 146.2962 seconds.
- shallow took 12.8073 seconds.
- deep took 13.0806 seconds.
- oboe:
- shallow took 148.8824 seconds.
- deep took 216.7555 seconds.
- shallow took 16.3094 seconds.
- deep took 17.728 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.0087 │ 0.0136 │ 0.0213 │
│ jsonpath-plus │ 0.3832 │ 0.3916 │ 0.3685 │
│ jsonpath │ 0.9513 │ 5.5776 │ 0.04 │
│ json-power-query │ 0.0053 │ 0.0057 │ 0.0077 │
│ JSONStream │ 2.2002 │ 2.2644 │ 'not possible' │
│ oboe │ 2.7596 │ 2.8447 │ '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.016 │ 0.0309 │ 0.0255 │
│ jsonpath-plus │ 0.7571 │ 0.8095 │ 0.6889 │
│ jsonpath │ 1.9249 │ 20.8872 │ 0.0761 │
│ json-power-query │ 0.0075 │ 0.01 │ 0.0087 │
│ JSONStream │ 4.5227 │ 4.6853 │ 'not possible' │
│ oboe │ 5.7411 │ 5.9309 │ '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 │ 1.9852 │ 2.0817 │ 1.5008 │
│ jsonpath │ 5.4554 │ 88.787 │ 0.15 │
│ json-power-query │ 0.0109 │ 0.0127 │ 0.0143 │
│ JSONStream │ 12.8073 │ 13.0806 │ 'not possible' │
│ oboe │ 16.3094 │ 17.728 │ 'not possible' │
│ map-filter-reduce │ 'not implemented' │ 'not implemented' │ 'not implemented' │
└───────────────────┴───────────────────┴───────────────────┴───────────────────┘
```
Loading