remove alloc, dealloc in wasm

This commit is contained in:
freestrings
2019-05-27 11:42:46 +09:00
parent d2a5d9092e
commit 3f89b9b183
14 changed files with 176 additions and 398 deletions

View File

@@ -61,9 +61,6 @@ let path = '$..book[?(@.price<30 && @.category=="fiction")]';
let template = jpw.compile(path);
let selector = jpw.selector(json);
let ptr = jpw.allocJson(json);
if(ptr == 0) console.error('invalid ptr');
let iterCount = 2000;
run('jsonpath', iterCount, function() { jp.query(json, path) })
@@ -73,15 +70,9 @@ run('jsonpath', iterCount, function() { jp.query(json, path) })
.then(function() {
return run('jsonpath-wasm- compile', iterCount, function() { template(json) });
})
.then(function() {
return run('jsonpath-wasm- compile-alloc', iterCount, function() { template(ptr) });
})
.then(function() {
return run('jsonpath-wasm- select', iterCount, function() { jpw.select(json, path) });
})
.then(function() {
return run('jsonpath-wasm- select-alloc', iterCount, function() { jpw.select(ptr, path) });
})
.finally(function() {
if(!jpw.deallocJson(ptr)) {
console.error('fail to dealloc');