v1.8.56
-
2.5 times better concurrency Cache performance!! Runtime Cache use DashMap Replace RwLock/HashMap, Because of the poor performance of the latter combination, about 160ns。
So this change can greatly improve the speed of concurrent cases(It is 2.5 times better than RwLock) -
this is the performance test for ExprRuntime and PySqlRuntime (use DashMap to Cache data)
// (Windows10 6Core16GBMem) use Time: 84.0079ms ,each:84 ns/op use QPS: 11900823 QPS/s
#[test]
fn test_bench_expr_runtime() {
let runtime = ExprRuntime::new();
runtime.eval("1+1", &serde_json::Value::Null);
runtime.eval("1+1", &serde_json::Value::Null);
let total = 1000000;
let now = std::time::Instant::now();
for _ in 0..total {
let r = runtime.eval("1+1", &serde_json::Value::Null).unwrap();
//println!("{}",r);
}
now.time(total);
now.qps(total);
}
//(Windows10 6Core16GBMem) use Time: 916.1591ms ,each:916 ns/op use QPS: 1091470 QPS/s
#[test]
fn test_bench_pysql_runtime() {
let runtime = PyRuntime::new(vec![]);
let mut engine =ExprRuntime::new();
let py_sql="SELECT * FROM biz_activity where
if name!=null:
name = #{name}
WHERE id = 'end';";
let mut env=serde_json::json!({});
runtime.eval(&DriverType::Mysql, &py_sql, &mut env, &mut engine).unwrap();
let total = 1000000;
let now = std::time::Instant::now();
for _ in 0..total {
runtime.eval(&DriverType::Mysql, &py_sql, &mut env, &mut engine).unwrap();
}
now.time(total);
now.qps(total);
}