Skip to content

Simple timecheck jsonpath wasm

changseok han edited this page Mar 17, 2019 · 4 revisions

Simple time check with dchester/jsonpath

jsonpath is dchester/jsonpath jsonpath-wasm is freestrings/jsonpath's compiled to webassembly

jsonpath-wasm is slow performance on Chrome browser and in NodeJS. not yet usable. :)

Browser Bench Demo

'$..book[?(@.price<30 && @.category=="fiction")]' (loop 2,000)

Chrome: 72.0

Something to wrong in chrome

jsonpath, 166
jsonpath-wasm- selector, 256
jsonpath-wasm- compile, 1168
jsonpath-wasm- compile-alloc, 645
jsonpath-wasm- select, 3224
jsonpath-wasm- select-alloc, 1427

Firefox: 65.0

jsonpath-wasm is faster than jsonpath

jsonpath, 125
jsonpath-wasm- selector, 101
jsonpath-wasm- compile, 169
jsonpath-wasm- compile-alloc, 78
jsonpath-wasm- select, 186
jsonpath-wasm- select-alloc, 93

NodeJs

  • NodeJS: 11.0

Rust > jsonpath > jsonpath-wasm

cd benches && ./bench_node_vs_rust.sh
$..book[?(@.price<30 && @.category==fiction)] (loop 100,000)

Rust: 

real	0m0.862s
user	0m0.862s
sys	0m0.000s

NodeJs - jsonpath module: 

real	0m3.667s
user	0m4.139s
sys	0m0.045s

NodeJs - jsonpath-wasm module - selector: 

real	0m5.331s
user	0m5.494s
sys	0m0.093s

NodeJs - jsonpath-wasm module - compile: 

real	0m8.665s
user	0m8.809s
sys	0m0.197s

NodeJs - jsonpath-wasm module - compile-alloc: 

real	0m4.014s
user	0m4.173s
sys	0m0.088s

NodeJs - jsonpath-wasm module - select:

real	0m9.843s
user	0m9.897s
sys	0m0.244s

NodeJs - jsonpath-wasm module - select-alloc:

real	0m5.212s
user	0m5.339s
sys	0m0.096s
Clone this wiki locally