mirror of
https://github.com/fluencelabs/jsonpath
synced 2025-06-29 07:41:45 +00:00
NodeJs와 간단한 성능 테스트
This commit is contained in:
21
benches/bench_bin/src/main.rs
Normal file
21
benches/bench_bin/src/main.rs
Normal 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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user