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

select

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

Rust - select: 

real	0m1.591s
user	0m1.591s
sys	0m0.000s

NodeJs - jsonpath - query: 

real	0m5.738s
user	0m6.235s
sys	0m0.025s

NodeJs - jsonpath-wasm - select:

real	0m14.204s
user	0m14.257s
sys	0m0.288s

selector, compile

Rust - selector: 

real	0m1.185s
user	0m1.185s
sys	0m0.000s

Rust - compile: 

real	0m1.902s
user	0m1.898s
sys	0m0.004s

NodeJs - jsonpath - query: 

real	0m5.703s
user	0m6.139s
sys	0m0.081s

NodeJs - jsonpath-wasm - selector: 

real	0m7.160s
user	0m7.313s
sys	0m0.128s

NodeJs - jsonpath-wasm - compile: 

real	0m12.673s
user	0m12.738s
sys	0m0.276s

NodeJs - jsonpath-wasm - compile-alloc: 

real	0m5.862s
user	0m6.056s
sys	0m0.085s
Clone this wiki locally