NodeJs와 간단한 성능 테스트

This commit is contained in:
freestrings
2019-03-07 18:44:06 +09:00
parent cd01540d75
commit f7b564dcd3
16 changed files with 441 additions and 20 deletions

View File

@ -0,0 +1,21 @@
extern crate jsonpath_lib as jsonpath;
extern crate serde_json;
use serde_json::Value;
use std::io::Read;
fn read_json(path: &str) -> String {
let mut f = std::fs::File::open(path).unwrap();
let mut contents = String::new();
f.read_to_string(&mut contents).unwrap();
contents
}
fn main() {
let string = read_json("../example.json");
let json: Value = serde_json::from_str(string.as_str()).unwrap();
let mut reader = jsonpath::reader(json);
for _ in 1..100000 {
let _ = reader(r#"$..book[?(@.price<30 && @.category=="fiction")]"#).unwrap();
}
}