Skip to content

Commit

Permalink
Add typing context for lowering (#1963)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-spacetime authored Nov 8, 2024
1 parent d51b5ac commit 4c0c755
Showing 1 changed file with 44 additions and 39 deletions.
83 changes: 44 additions & 39 deletions crates/physical-plan/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@ use crate::plan;
use crate::plan::{CrossJoin, Filter, PhysicalCtx, PhysicalExpr, PhysicalPlan};
use spacetimedb_expr::expr::{Expr, Let, LetCtx, Project, RelExpr, Select};
use spacetimedb_expr::statement::Statement;
use spacetimedb_expr::ty::TyId;
use spacetimedb_expr::ty::{TyCtx, TyId};
use spacetimedb_expr::StatementCtx;
use spacetimedb_sql_parser::ast::BinOp;

fn compile_expr(ctx: &LetCtx, expr: Expr) -> PhysicalExpr {
fn compile_expr(_ctx: &TyCtx, vars: &LetCtx, expr: Expr) -> PhysicalExpr {
match expr {
Expr::Bin(op, lhs, rhs) => {
let lhs = compile_expr(ctx, *lhs);
let rhs = compile_expr(ctx, *rhs);
let lhs = compile_expr(_ctx, vars, *lhs);
let rhs = compile_expr(_ctx, vars, *rhs);
PhysicalExpr::BinOp(op, Box::new(lhs), Box::new(rhs))
}
Expr::Var(sym, _ty) => {
let var = ctx.get_var(sym).cloned().unwrap();
compile_expr(ctx, var)
let var = vars.get_var(sym).cloned().unwrap();
compile_expr(_ctx, vars, var)
}
Expr::Row(row, ty) => {
PhysicalExpr::Tuple(
row.into_vec()
.into_iter()
// The `sym` is inline in `expr`
.map(|(_sym, expr)| compile_expr(ctx, expr))
.map(|(_sym, expr)| compile_expr(_ctx, vars, expr))
.collect(),
ty,
)
}
Expr::Lit(value, ty) => PhysicalExpr::Value(value, ty),
Expr::Field(expr, pos, ty) => {
let expr = compile_expr(ctx, *expr);
let expr = compile_expr(_ctx, vars, *expr);
PhysicalExpr::Field(Box::new(expr), pos, ty)
}
Expr::Input(ty) => PhysicalExpr::Input(ty),
Expand All @@ -44,15 +44,16 @@ fn join_exprs(exprs: Vec<PhysicalExpr>) -> Option<PhysicalExpr> {
.reduce(|lhs, rhs| PhysicalExpr::BinOp(BinOp::And, Box::new(lhs), Box::new(rhs)))
}

fn compile_let(expr: Let) -> Vec<PhysicalExpr> {
let ctx = LetCtx { vars: &expr.vars };

expr.exprs.into_iter().map(|expr| compile_expr(&ctx, expr)).collect()
fn compile_let(ctx: &TyCtx, Let { vars, exprs }: Let) -> Vec<PhysicalExpr> {
exprs
.into_iter()
.map(|expr| compile_expr(ctx, &LetCtx { vars: &vars }, expr))
.collect()
}

fn compile_filter(select: Select) -> PhysicalPlan {
let input = compile_rel_expr(select.input);
if let Some(op) = join_exprs(compile_let(select.expr)) {
fn compile_filter(ctx: &TyCtx, select: Select) -> PhysicalPlan {
let input = compile_rel_expr(ctx, select.input);
if let Some(op) = join_exprs(compile_let(ctx, select.expr)) {
PhysicalPlan::Filter(Filter {
input: Box::new(input),
op,
Expand All @@ -62,19 +63,19 @@ fn compile_filter(select: Select) -> PhysicalPlan {
}
}

fn compile_project(expr: Project) -> PhysicalPlan {
fn compile_project(ctx: &TyCtx, expr: Project) -> PhysicalPlan {
let proj = plan::Project {
input: Box::new(compile_rel_expr(expr.input)),
op: join_exprs(compile_let(expr.expr)).unwrap(),
input: Box::new(compile_rel_expr(ctx, expr.input)),
op: join_exprs(compile_let(ctx, expr.expr)).unwrap(),
};

PhysicalPlan::Project(proj)
}

fn compile_cross_joins(joins: Vec<RelExpr>, ty: TyId) -> PhysicalPlan {
fn compile_cross_joins(ctx: &TyCtx, joins: Vec<RelExpr>, ty: TyId) -> PhysicalPlan {
joins
.into_iter()
.map(compile_rel_expr)
.map(|expr| compile_rel_expr(ctx, expr))
.reduce(|lhs, rhs| {
PhysicalPlan::CrossJoin(CrossJoin {
lhs: Box::new(lhs),
Expand All @@ -85,12 +86,12 @@ fn compile_cross_joins(joins: Vec<RelExpr>, ty: TyId) -> PhysicalPlan {
.unwrap()
}

fn compile_rel_expr(ast: RelExpr) -> PhysicalPlan {
fn compile_rel_expr(ctx: &TyCtx, ast: RelExpr) -> PhysicalPlan {
match ast {
RelExpr::RelVar(table, _ty) => PhysicalPlan::TableScan(table),
RelExpr::Select(select) => compile_filter(*select),
RelExpr::Proj(proj) => compile_project(*proj),
RelExpr::Join(joins, ty) => compile_cross_joins(joins.into_vec(), ty),
RelExpr::Select(select) => compile_filter(ctx, *select),
RelExpr::Proj(proj) => compile_project(ctx, *proj),
RelExpr::Join(joins, ty) => compile_cross_joins(ctx, joins.into_vec(), ty),
RelExpr::Union(_, _) | RelExpr::Minus(_, _) | RelExpr::Dedup(_) => {
unreachable!("DISTINCT is not implemented")
}
Expand All @@ -102,9 +103,9 @@ fn compile_rel_expr(ast: RelExpr) -> PhysicalPlan {
/// The input [Statement] is assumed to be valid so the lowering is not expected to fail.
///
/// **NOTE:** It does not optimize the plan.
pub fn compile(ast: StatementCtx) -> PhysicalCtx {
pub fn compile<'a>(ctx: &TyCtx, ast: StatementCtx<'a>) -> PhysicalCtx<'a> {
let plan = match ast.statement {
Statement::Select(expr) => compile_rel_expr(expr),
Statement::Select(expr) => compile_rel_expr(ctx, expr),
_ => {
unreachable!("Only `SELECT` is implemented")
}
Expand Down Expand Up @@ -151,10 +152,11 @@ mod tests {
])
}

fn compile_sql_sub_test(sql: &str) -> ResultTest<StatementCtx> {
fn compile_sql_sub_test(sql: &str) -> ResultTest<(StatementCtx, TyCtx)> {
let tx = SchemaViewer(module_def());
let expr = compile_sql_sub(&mut TyCtx::default(), sql, &tx)?;
Ok(expr)
let mut ctx = TyCtx::default();
let expr = compile_sql_sub(&mut ctx, sql, &tx)?;
Ok((expr, ctx))
}

fn compile_sql_stmt_test(sql: &str) -> ResultTest<StatementCtx> {
Expand All @@ -165,29 +167,30 @@ mod tests {

#[test]
fn test_project() -> ResultTest<()> {
let ast = compile_sql_sub_test("SELECT * FROM t")?;
assert!(matches!(compile(ast).plan, PhysicalPlan::TableScan(_)));
let (ast, ctx) = compile_sql_sub_test("SELECT * FROM t")?;
assert!(matches!(compile(&ctx, ast).plan, PhysicalPlan::TableScan(_)));

let ast = compile_sql_stmt_test("SELECT u32 FROM t")?;
assert!(matches!(compile(ast).plan, PhysicalPlan::Project(_)));
assert!(matches!(compile(&ctx, ast).plan, PhysicalPlan::Project(_)));

Ok(())
}

#[test]
fn test_select() -> ResultTest<()> {
let ast = compile_sql_sub_test("SELECT * FROM t WHERE u32 = 1")?;
assert!(matches!(compile(ast).plan, PhysicalPlan::Filter(_)));
let (ast, ctx) = compile_sql_sub_test("SELECT * FROM t WHERE u32 = 1")?;
assert!(matches!(compile(&ctx, ast).plan, PhysicalPlan::Filter(_)));

let ast = compile_sql_sub_test("SELECT * FROM t WHERE u32 = 1 AND f32 = f32")?;
assert!(matches!(compile(ast).plan, PhysicalPlan::Filter(_)));
let (ast, ctx) = compile_sql_sub_test("SELECT * FROM t WHERE u32 = 1 AND f32 = f32")?;
assert!(matches!(compile(&ctx, ast).plan, PhysicalPlan::Filter(_)));
Ok(())
}

#[test]
fn test_joins() -> ResultTest<()> {
// Check we can do a cross join
let ast = compile(compile_sql_sub_test("SELECT t.* FROM t JOIN u")?).plan;
let (ast, ctx) = compile_sql_sub_test("SELECT t.* FROM t JOIN u")?;
let ast = compile(&ctx, ast).plan;
let plan::Project { input, op } = ast.as_project().unwrap();
let CrossJoin { lhs, rhs, ty: _ } = input.as_cross().unwrap();

Expand All @@ -196,7 +199,8 @@ mod tests {
assert!(matches!(&**rhs, PhysicalPlan::TableScan(_)));

// Check we can do multiple joins
let ast = compile(compile_sql_sub_test("SELECT t.* FROM t JOIN u JOIN x")?).plan;
let (ast, ctx) = compile_sql_sub_test("SELECT t.* FROM t JOIN u JOIN x")?;
let ast = compile(&ctx, ast).plan;
let plan::Project { input, op: _ } = ast.as_project().unwrap();
let CrossJoin { lhs, rhs, ty: _ } = input.as_cross().unwrap();
assert!(matches!(&**rhs, PhysicalPlan::TableScan(_)));
Expand All @@ -206,7 +210,8 @@ mod tests {
assert!(matches!(&**rhs, PhysicalPlan::TableScan(_)));

// Check we can do a join with a filter
let ast = compile(compile_sql_stmt_test("SELECT t.* FROM t JOIN u ON t.u32 = u.u32")?).plan;
let (ast, ctx) = compile_sql_sub_test("SELECT t.* FROM t JOIN u ON t.u32 = u.u32")?;
let ast = compile(&ctx, ast).plan;

let plan::Project { input, op: _ } = ast.as_project().unwrap();
let Filter { input, op } = input.as_filter().unwrap();
Expand Down

2 comments on commit 4c0c755

@github-actions
Copy link

@github-actions github-actions bot commented on 4c0c755 Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Callgrind benchmark results

Callgrind Benchmark Report

These benchmarks were run using callgrind,
an instruction-level profiler. They allow comparisons between sqlite (sqlite), SpacetimeDB running through a module (stdb_module), and the underlying SpacetimeDB data storage engine (stdb_raw). Callgrind emulates a CPU to collect the below estimates.

Measurement changes larger than five percent are in bold.

In-memory benchmarks

callgrind: empty transaction

db total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw 6399 6399 0.00% 6523 6523 0.00%
sqlite 5579 5579 0.00% 6019 6019 0.00%

callgrind: filter

db schema indices count preload _column data_type total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str no_index 64 128 1 u64 76593 76593 0.00% 76993 77017 -0.03%
stdb_raw u32_u64_str no_index 64 128 2 string 120180 119091 0.91% 120792 119747 0.87%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 25083 25083 0.00% 25615 25647 -0.12%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 24051 24051 0.00% 24423 24419 0.02%
sqlite u32_u64_str no_index 64 128 2 string 144695 144701 -0.00% 146261 146263 -0.00%
sqlite u32_u64_str no_index 64 128 1 u64 124044 124050 -0.00% 125334 125344 -0.01%
sqlite u32_u64_str btree_each_column 64 128 1 u64 131361 131361 0.00% 132807 132815 -0.01%
sqlite u32_u64_str btree_each_column 64 128 2 string 134494 134494 0.00% 136100 136096 0.00%

callgrind: insert bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 64 128 877162 877782 -0.07% 931834 932434 -0.06%
stdb_raw u32_u64_str btree_each_column 64 128 1023972 1026681 -0.26% 1065492 1068681 -0.30%
sqlite u32_u64_str unique_0 64 128 398320 398320 0.00% 415178 415186 -0.00%
sqlite u32_u64_str btree_each_column 64 128 983637 983637 0.00% 1020517 1020529 -0.00%

callgrind: iterate

db schema indices count total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 153726 153726 0.00% 153866 153866 0.00%
stdb_raw u32_u64_str unique_0 64 16751 16751 0.00% 16875 16879 -0.02%
sqlite u32_u64_str unique_0 1024 1067255 1067255 0.00% 1070663 1070663 0.00%
sqlite u32_u64_str unique_0 64 76207 76207 0.00% 77445 77445 0.00%

callgrind: serialize_product_value

count format total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
64 json 47528 47528 0.00% 50282 50282 0.00%
64 bsatn 25509 25509 0.00% 27821 27821 0.00%
16 bsatn 8200 8200 0.00% 9628 9628 0.00%
16 json 12188 12188 0.00% 14194 14194 0.00%

callgrind: update bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 1024 20490139 20083521 2.02% 21131437 20660719 2.28%
stdb_raw u32_u64_str unique_0 64 128 1284775 1284846 -0.01% 1327581 1326336 0.09%
sqlite u32_u64_str unique_0 1024 1024 1802200 1802182 0.00% 1811384 1811362 0.00%
sqlite u32_u64_str unique_0 64 128 128528 128528 0.00% 131492 131492 0.00%
On-disk benchmarks

callgrind: empty transaction

db total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw 6404 6404 0.00% 6544 6544 0.00%
sqlite 5621 5621 0.00% 6121 6121 0.00%

callgrind: filter

db schema indices count preload _column data_type total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str no_index 64 128 1 u64 76598 76598 0.00% 76978 76982 -0.01%
stdb_raw u32_u64_str no_index 64 128 2 string 119096 119096 0.00% 119756 119844 -0.07%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 25089 25090 -0.00% 25577 25614 -0.14%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 24056 24056 0.00% 24400 24404 -0.02%
sqlite u32_u64_str no_index 64 128 1 u64 125965 125965 0.00% 127543 127547 -0.00%
sqlite u32_u64_str no_index 64 128 2 string 146616 146616 0.00% 148454 148450 0.00%
sqlite u32_u64_str btree_each_column 64 128 2 string 136616 136616 0.00% 138724 138728 -0.00%
sqlite u32_u64_str btree_each_column 64 128 1 u64 133463 133457 0.00% 135347 135341 0.00%

callgrind: insert bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 64 128 826115 826510 -0.05% 879949 880180 -0.03%
stdb_raw u32_u64_str btree_each_column 64 128 977599 975935 0.17% 1048121 1046557 0.15%
sqlite u32_u64_str unique_0 64 128 415857 415857 0.00% 431867 431871 -0.00%
sqlite u32_u64_str btree_each_column 64 128 1021898 1021898 0.00% 1057602 1057614 -0.00%

callgrind: iterate

db schema indices count total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 153731 153731 0.00% 153855 153855 0.00%
stdb_raw u32_u64_str unique_0 64 16756 16756 0.00% 16876 16876 0.00%
sqlite u32_u64_str unique_0 1024 1070341 1070323 0.00% 1074115 1074097 0.00%
sqlite u32_u64_str unique_0 64 78006 77973 0.04% 79336 79303 0.04%

callgrind: serialize_product_value

count format total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
64 json 47528 47528 0.00% 50282 50282 0.00%
64 bsatn 25509 25509 0.00% 27821 27821 0.00%
16 bsatn 8200 8200 0.00% 9628 9628 0.00%
16 json 12188 12188 0.00% 14194 14194 0.00%

callgrind: update bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 1024 19003809 19001556 0.01% 19643755 19642490 0.01%
stdb_raw u32_u64_str unique_0 64 128 1238098 1238097 0.00% 1309282 1309297 -0.00%
sqlite u32_u64_str unique_0 1024 1024 1809743 1809743 0.00% 1818455 1818455 0.00%
sqlite u32_u64_str unique_0 64 128 132654 132654 0.00% 135834 135834 0.00%

@github-actions
Copy link

@github-actions github-actions bot commented on 4c0c755 Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Criterion benchmark results

Criterion benchmark report

YOU SHOULD PROBABLY IGNORE THESE RESULTS.

Criterion is a wall time based benchmarking system that is extremely noisy when run on CI. We collect these results for longitudinal analysis, but they are not reliable for comparing individual PRs.

Go look at the callgrind report instead.

empty

db on disk new latency old latency new throughput old throughput
sqlite 💿 429.2±3.53ns 422.9±4.82ns - -
sqlite 🧠 419.6±3.49ns 414.3±2.35ns - -
stdb_raw 💿 778.3±1.31ns 775.5±2.50ns - -
stdb_raw 🧠 778.1±3.69ns 774.6±1.09ns - -

insert_1

db on disk schema indices preload new latency old latency new throughput old throughput

insert_bulk

db on disk schema indices preload count new latency old latency new throughput old throughput
sqlite 💿 u32_u64_str btree_each_column 2048 256 593.9±2.69µs 593.3±0.45µs 1683 tx/sec 1685 tx/sec
sqlite 💿 u32_u64_str unique_0 2048 256 156.6±0.70µs 151.5±1.67µs 6.2 Ktx/sec 6.4 Ktx/sec
sqlite 💿 u32_u64_u64 btree_each_column 2048 256 477.7±0.70µs 487.3±40.43µs 2.0 Ktx/sec 2.0 Ktx/sec
sqlite 💿 u32_u64_u64 unique_0 2048 256 142.3±0.64µs 138.5±0.82µs 6.9 Ktx/sec 7.1 Ktx/sec
sqlite 🧠 u32_u64_str btree_each_column 2048 256 456.8±1.64µs 452.3±0.43µs 2.1 Ktx/sec 2.2 Ktx/sec
sqlite 🧠 u32_u64_str unique_0 2048 256 126.9±0.90µs 126.7±0.32µs 7.7 Ktx/sec 7.7 Ktx/sec
sqlite 🧠 u32_u64_u64 btree_each_column 2048 256 377.6±1.14µs 373.6±0.36µs 2.6 Ktx/sec 2.6 Ktx/sec
sqlite 🧠 u32_u64_u64 unique_0 2048 256 109.2±1.07µs 109.8±0.19µs 8.9 Ktx/sec 8.9 Ktx/sec
stdb_raw 💿 u32_u64_str btree_each_column 2048 256 575.3±64.44µs 595.8±16.11µs 1738 tx/sec 1678 tx/sec
stdb_raw 💿 u32_u64_str unique_0 2048 256 447.0±49.78µs 489.4±13.94µs 2.2 Ktx/sec 2043 tx/sec
stdb_raw 💿 u32_u64_u64 btree_each_column 2048 256 380.4±7.63µs 375.5±9.37µs 2.6 Ktx/sec 2.6 Ktx/sec
stdb_raw 💿 u32_u64_u64 unique_0 2048 256 347.9±12.90µs 300.6±5.64µs 2.8 Ktx/sec 3.2 Ktx/sec
stdb_raw 🧠 u32_u64_str btree_each_column 2048 256 296.2±0.43µs 299.4±0.16µs 3.3 Ktx/sec 3.3 Ktx/sec
stdb_raw 🧠 u32_u64_str unique_0 2048 256 229.1±0.78µs 230.6±0.46µs 4.3 Ktx/sec 4.2 Ktx/sec
stdb_raw 🧠 u32_u64_u64 btree_each_column 2048 256 234.7±0.20µs 236.5±0.28µs 4.2 Ktx/sec 4.1 Ktx/sec
stdb_raw 🧠 u32_u64_u64 unique_0 2048 256 207.3±0.37µs 206.9±0.28µs 4.7 Ktx/sec 4.7 Ktx/sec

iterate

db on disk schema indices new latency old latency new throughput old throughput
sqlite 💿 u32_u64_str unique_0 26.0±0.06µs 25.1±0.16µs 37.6 Ktx/sec 38.9 Ktx/sec
sqlite 💿 u32_u64_u64 unique_0 22.2±0.09µs 21.7±0.10µs 44.1 Ktx/sec 45.1 Ktx/sec
sqlite 🧠 u32_u64_str unique_0 23.3±0.08µs 22.1±0.04µs 41.9 Ktx/sec 44.3 Ktx/sec
sqlite 🧠 u32_u64_u64 unique_0 19.7±0.27µs 19.1±0.10µs 49.5 Ktx/sec 51.1 Ktx/sec
stdb_raw 💿 u32_u64_str unique_0 4.9±0.00µs 4.9±0.00µs 200.1 Ktx/sec 199.3 Ktx/sec
stdb_raw 💿 u32_u64_u64 unique_0 4.8±0.00µs 4.8±0.00µs 204.2 Ktx/sec 203.9 Ktx/sec
stdb_raw 🧠 u32_u64_str unique_0 4.9±0.00µs 4.9±0.00µs 200.2 Ktx/sec 200.1 Ktx/sec
stdb_raw 🧠 u32_u64_u64 unique_0 4.8±0.00µs 4.8±0.00µs 204.3 Ktx/sec 204.1 Ktx/sec

find_unique

db on disk key type preload new latency old latency new throughput old throughput

filter

db on disk key type index strategy load count new latency old latency new throughput old throughput
sqlite 💿 string index 2048 256 70.9±0.18µs 67.9±0.20µs 13.8 Ktx/sec 14.4 Ktx/sec
sqlite 💿 u64 index 2048 256 64.9±0.33µs 64.0±0.12µs 15.0 Ktx/sec 15.3 Ktx/sec
sqlite 🧠 string index 2048 256 66.9±0.09µs 65.3±0.16µs 14.6 Ktx/sec 15.0 Ktx/sec
sqlite 🧠 u64 index 2048 256 58.7±0.21µs 58.2±0.17µs 16.6 Ktx/sec 16.8 Ktx/sec
stdb_raw 💿 string index 2048 256 5.1±0.00µs 5.1±0.00µs 192.7 Ktx/sec 192.7 Ktx/sec
stdb_raw 💿 u64 index 2048 256 5.0±0.00µs 5.0±0.00µs 195.7 Ktx/sec 195.6 Ktx/sec
stdb_raw 🧠 string index 2048 256 5.1±0.00µs 5.1±0.00µs 192.4 Ktx/sec 192.6 Ktx/sec
stdb_raw 🧠 u64 index 2048 256 5.0±0.00µs 5.0±0.00µs 195.8 Ktx/sec 195.7 Ktx/sec

serialize

schema format count new latency old latency new throughput old throughput
u32_u64_str bflatn_to_bsatn_fast_path 100 3.6±0.01µs 3.6±0.00µs 26.4 Mtx/sec 26.5 Mtx/sec
u32_u64_str bflatn_to_bsatn_slow_path 100 3.6±0.01µs 3.6±0.03µs 26.6 Mtx/sec 26.3 Mtx/sec
u32_u64_str bsatn 100 15.5±0.16ns 7.1±0.06ns 6.0 Gtx/sec 13.1 Gtx/sec
u32_u64_str bsatn 100 2.4±0.02µs 2.4±0.02µs 39.5 Mtx/sec 39.5 Mtx/sec
u32_u64_str json 100 5.2±0.05µs 5.0±0.03µs 18.4 Mtx/sec 19.1 Mtx/sec
u32_u64_str json 100 8.4±0.05µs 8.4±0.05µs 11.4 Mtx/sec 11.3 Mtx/sec
u32_u64_str product_value 100 1018.4±1.69ns 1020.3±0.77ns 93.6 Mtx/sec 93.5 Mtx/sec
u32_u64_u64 bflatn_to_bsatn_fast_path 100 1011.5±10.22ns 1011.6±1.32ns 94.3 Mtx/sec 94.3 Mtx/sec
u32_u64_u64 bflatn_to_bsatn_slow_path 100 2.8±0.00µs 2.8±0.02µs 34.3 Mtx/sec 34.2 Mtx/sec
u32_u64_u64 bsatn 100 14.8±0.03ns 6.7±0.01ns 6.3 Gtx/sec 13.9 Gtx/sec
u32_u64_u64 bsatn 100 1736.1±22.21ns 1743.7±19.88ns 54.9 Mtx/sec 54.7 Mtx/sec
u32_u64_u64 json 100 3.3±0.02µs 3.2±0.10µs 28.7 Mtx/sec 29.7 Mtx/sec
u32_u64_u64 json 100 5.9±0.03µs 5.9±0.05µs 16.0 Mtx/sec 16.2 Mtx/sec
u32_u64_u64 product_value 100 1015.9±1.52ns 1015.3±0.75ns 93.9 Mtx/sec 93.9 Mtx/sec
u64_u64_u32 bflatn_to_bsatn_fast_path 100 759.3±0.73ns 759.5±0.51ns 125.6 Mtx/sec 125.6 Mtx/sec
u64_u64_u32 bflatn_to_bsatn_slow_path 100 2.8±0.04µs 2.8±0.01µs 34.2 Mtx/sec 34.0 Mtx/sec
u64_u64_u32 bsatn 100 1743.1±22.20ns 1743.2±22.91ns 54.7 Mtx/sec 54.7 Mtx/sec
u64_u64_u32 bsatn 100 704.5±0.66ns 691.7±1.08ns 135.4 Mtx/sec 137.9 Mtx/sec
u64_u64_u32 json 100 3.2±0.02µs 3.2±0.01µs 30.1 Mtx/sec 30.2 Mtx/sec
u64_u64_u32 json 100 5.9±0.01µs 5.9±0.04µs 16.1 Mtx/sec 16.2 Mtx/sec
u64_u64_u32 product_value 100 1014.7±1.07ns 1015.1±0.57ns 94.0 Mtx/sec 94.0 Mtx/sec

stdb_module_large_arguments

arg size new latency old latency new throughput old throughput
64KiB 104.2±6.90µs 100.9±8.70µs - -

stdb_module_print_bulk

line count new latency old latency new throughput old throughput
1 56.6±4.61µs 54.0±7.03µs - -
100 597.2±8.27µs 606.0±6.86µs - -
1000 5.2±0.49ms 5.4±0.04ms - -

remaining

name new latency old latency new throughput old throughput
special/db_game/circles/load=10 52.9±2.03ms 53.2±3.68ms - -
special/db_game/circles/load=100 52.2±4.50ms 44.2±6.12ms - -
special/db_game/ia_loop/load=500 146.4±1.42ms 148.8±1.13ms - -
special/db_game/ia_loop/load=5000 5.3±0.03s 5.4±0.03s - -
sqlite/💿/update_bulk/u32_u64_str/unique_0/load=2048/count=256 57.4±0.17µs 57.5±0.23µs 17.0 Ktx/sec 17.0 Ktx/sec
sqlite/💿/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 48.4±0.20µs 48.1±0.17µs 20.2 Ktx/sec 20.3 Ktx/sec
sqlite/🧠/update_bulk/u32_u64_str/unique_0/load=2048/count=256 42.8±0.24µs 41.1±0.08µs 22.8 Ktx/sec 23.8 Ktx/sec
sqlite/🧠/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 37.3±0.05µs 37.5±0.05µs 26.2 Ktx/sec 26.0 Ktx/sec
stdb_module/💿/update_bulk/u32_u64_str/unique_0/load=2048/count=256 1253.4±21.84µs 1267.9±12.24µs 797 tx/sec 788 tx/sec
stdb_module/💿/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 1006.9±6.83µs 1021.2±11.74µs 993 tx/sec 979 tx/sec
stdb_raw/💿/update_bulk/u32_u64_str/unique_0/load=2048/count=256 529.1±15.37µs 606.5±20.18µs 1890 tx/sec 1648 tx/sec
stdb_raw/💿/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 482.0±7.98µs 483.0±10.95µs 2.0 Ktx/sec 2.0 Ktx/sec
stdb_raw/🧠/update_bulk/u32_u64_str/unique_0/load=2048/count=256 363.6±0.39µs 363.5±0.33µs 2.7 Ktx/sec 2.7 Ktx/sec
stdb_raw/🧠/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 325.9±0.17µs 327.4±0.95µs 3.0 Ktx/sec 3.0 Ktx/sec

Please sign in to comment.