Skip to content

Commit

Permalink
Correct Schema::check_compatible to resolve types in a ModuleDef (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kazimuth authored Oct 10, 2024
1 parent 1e35fe6 commit 37087c2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 deletions.
8 changes: 4 additions & 4 deletions crates/core/src/db/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ pub fn update_database(
let existing_tables = stdb.get_all_tables_mut(tx)?;

// TODO: consider using `ErrorStream` here.
let old_def = plan.old_def();
let old_module_def = plan.old_def();
for table in existing_tables
.iter()
.filter(|table| table.table_type != StTableType::System)
{
let old_def = old_def
let old_def = old_module_def
.table(&table.table_name[..])
.ok_or_else(|| anyhow::anyhow!("table {} not found in old_def", table.table_name))?;
.ok_or_else(|| anyhow::anyhow!("table {} not found in old_module_def", table.table_name))?;

table.check_compatible(old_def)?;
table.check_compatible(old_module_def, old_def)?;
}

match plan {
Expand Down
27 changes: 14 additions & 13 deletions crates/schema/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub trait Schema: Sized {
fn from_module_def(module_def: &ModuleDef, def: &Self::Def, parent_id: Self::ParentId, id: Self::Id) -> Self;

/// Check that a schema entity is compatible with a definition.
fn check_compatible(&self, def: &Self::Def) -> Result<(), anyhow::Error>;
fn check_compatible(&self, module_def: &ModuleDef, def: &Self::Def) -> Result<(), anyhow::Error>;
}

/// A data structure representing the schema of a database table.
Expand Down Expand Up @@ -602,7 +602,7 @@ impl Schema for TableSchema {
)
}

fn check_compatible(&self, def: &Self::Def) -> Result<(), anyhow::Error> {
fn check_compatible(&self, module_def: &ModuleDef, def: &Self::Def) -> Result<(), anyhow::Error> {
ensure_eq!(&self.table_name[..], &def.name[..], "Table name mismatch");
ensure_eq!(self.primary_key, def.primary_key, "Primary key mismatch");
let def_table_access: StAccess = (def.table_access).into();
Expand All @@ -615,7 +615,7 @@ impl Schema for TableSchema {
.columns
.get(col.col_pos.0 as usize)
.ok_or_else(|| anyhow::anyhow!("Column {} not found in definition", col.col_pos.0))?;
col.check_compatible(col_def)?;
col.check_compatible(module_def, col_def)?;
}
ensure_eq!(self.columns.len(), def.columns.len(), "Column count mismatch");

Expand All @@ -624,7 +624,7 @@ impl Schema for TableSchema {
.indexes
.get(&index.index_name[..])
.ok_or_else(|| anyhow::anyhow!("Index {} not found in definition", index.index_id.0))?;
index.check_compatible(index_def)?;
index.check_compatible(module_def, index_def)?;
}
ensure_eq!(self.indexes.len(), def.indexes.len(), "Index count mismatch");

Expand All @@ -633,7 +633,7 @@ impl Schema for TableSchema {
.constraints
.get(&constraint.constraint_name[..])
.ok_or_else(|| anyhow::anyhow!("Constraint {} not found in definition", constraint.constraint_id.0))?;
constraint.check_compatible(constraint_def)?;
constraint.check_compatible(module_def, constraint_def)?;
}
ensure_eq!(
self.constraints.len(),
Expand All @@ -646,7 +646,7 @@ impl Schema for TableSchema {
.sequences
.get(&sequence.sequence_name[..])
.ok_or_else(|| anyhow::anyhow!("Sequence {} not found in definition", sequence.sequence_id.0))?;
sequence.check_compatible(sequence_def)?;
sequence.check_compatible(module_def, sequence_def)?;
}
ensure_eq!(self.sequences.len(), def.sequences.len(), "Sequence count mismatch");

Expand All @@ -655,7 +655,7 @@ impl Schema for TableSchema {
.schedule
.as_ref()
.ok_or_else(|| anyhow::anyhow!("Schedule not found in definition"))?;
schedule.check_compatible(schedule_def)?;
schedule.check_compatible(module_def, schedule_def)?;
}
ensure_eq!(
self.schedule.is_some(),
Expand Down Expand Up @@ -754,9 +754,10 @@ impl Schema for ColumnSchema {
}
}

fn check_compatible(&self, def: &Self::Def) -> Result<(), anyhow::Error> {
fn check_compatible(&self, module_def: &ModuleDef, def: &Self::Def) -> Result<(), anyhow::Error> {
ensure_eq!(&self.col_name[..], &def.name[..], "Column name mismatch");
ensure_eq!(self.col_type, def.ty, "Column type mismatch");
let resolved_def_ty = WithTypespace::new(module_def.typespace(), &def.ty).resolve_refs()?;
ensure_eq!(self.col_type, resolved_def_ty, "Column type mismatch");
ensure_eq!(self.col_pos, def.col_id, "Columnh ID mismatch");
Ok(())
}
Expand Down Expand Up @@ -843,7 +844,7 @@ impl Schema for SequenceSchema {
}
}

fn check_compatible(&self, def: &Self::Def) -> Result<(), anyhow::Error> {
fn check_compatible(&self, _module_def: &ModuleDef, def: &Self::Def) -> Result<(), anyhow::Error> {
ensure_eq!(&self.sequence_name[..], &def.name[..], "Sequence name mismatch");
ensure_eq!(self.col_pos, def.column, "Sequence column mismatch");
ensure_eq!(self.increment, def.increment, "Sequence increment mismatch");
Expand Down Expand Up @@ -895,7 +896,7 @@ impl Schema for ScheduleSchema {
}
}

fn check_compatible(&self, def: &Self::Def) -> Result<(), anyhow::Error> {
fn check_compatible(&self, _module_def: &ModuleDef, def: &Self::Def) -> Result<(), anyhow::Error> {
ensure_eq!(&self.schedule_name[..], &def.name[..], "Schedule name mismatch");
ensure_eq!(
&self.reducer_name[..],
Expand Down Expand Up @@ -939,7 +940,7 @@ impl Schema for IndexSchema {
}
}

fn check_compatible(&self, def: &Self::Def) -> Result<(), anyhow::Error> {
fn check_compatible(&self, _module_def: &ModuleDef, def: &Self::Def) -> Result<(), anyhow::Error> {
ensure_eq!(&self.index_name[..], &def.name[..], "Index name mismatch");
ensure_eq!(&self.index_algorithm, &def.algorithm, "Index algorithm mismatch");
Ok(())
Expand Down Expand Up @@ -1002,7 +1003,7 @@ impl Schema for ConstraintSchema {
}
}

fn check_compatible(&self, def: &Self::Def) -> Result<(), anyhow::Error> {
fn check_compatible(&self, _module_def: &ModuleDef, def: &Self::Def) -> Result<(), anyhow::Error> {
ensure_eq!(&self.constraint_name[..], &def.name[..], "Constraint name mismatch");
ensure_eq!(&self.data, &def.data, "Constraint data mismatch");
Ok(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import logging


class AddTablePseudomigration(Smoketest):
class AddTableAutoMigration(Smoketest):
MODULE_CODE = """
use spacetimedb::{println, ReducerContext, Table};
use spacetimedb::{println, ReducerContext, Table, SpacetimeType};
#[spacetimedb::table(name = person)]
pub struct Person {
Expand All @@ -23,6 +23,19 @@ class AddTablePseudomigration(Smoketest):
println!("{}: {}", prefix, person.name);
}
}
#[spacetimedb::table(name = point_mass)]
pub struct PointMass {
mass: f64,
/// This used to cause an error when check_compatible did not resolve types in a `ModuleDef`.
position: Vector2,
}
#[derive(SpacetimeType, Clone, Copy)]
pub struct Vector2 {
x: f64,
y: f64,
}
"""

MODULE_CODE_UPDATED = (
Expand All @@ -47,7 +60,7 @@ class AddTablePseudomigration(Smoketest):
"""
)

def test_add_table_pseudomigration(self):
def test_add_table_auto_migration(self):
"""This tests uploading a module with a schema change that should not require clearing the database."""

logging.info("Initial publish complete")
Expand Down

2 comments on commit 37087c2

@github-actions
Copy link

@github-actions github-actions bot commented on 37087c2 Oct 10, 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 💿 413.2±2.08ns 404.8±0.96ns - -
sqlite 🧠 405.4±1.68ns 400.9±2.04ns - -
stdb_raw 💿 635.7±0.92ns 625.6±3.10ns - -
stdb_raw 🧠 632.0±3.30ns 625.5±1.07ns - -

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 603.8±59.42µs 589.2±0.81µs 1656 tx/sec 1697 tx/sec
sqlite 💿 u32_u64_str unique_0 2048 256 151.0±0.22µs 151.3±0.89µs 6.5 Ktx/sec 6.5 Ktx/sec
sqlite 💿 u32_u64_u64 btree_each_column 2048 256 466.2±0.30µs 469.3±0.94µs 2.1 Ktx/sec 2.1 Ktx/sec
sqlite 💿 u32_u64_u64 unique_0 2048 256 138.4±0.55µs 137.7±0.48µs 7.1 Ktx/sec 7.1 Ktx/sec
sqlite 🧠 u32_u64_str btree_each_column 2048 256 448.1±0.57µs 452.9±1.24µs 2.2 Ktx/sec 2.2 Ktx/sec
sqlite 🧠 u32_u64_str unique_0 2048 256 125.1±0.59µs 122.1±0.41µs 7.8 Ktx/sec 8.0 Ktx/sec
sqlite 🧠 u32_u64_u64 btree_each_column 2048 256 365.8±0.34µs 367.4±0.59µs 2.7 Ktx/sec 2.7 Ktx/sec
sqlite 🧠 u32_u64_u64 unique_0 2048 256 104.8±1.09µs 104.3±0.43µs 9.3 Ktx/sec 9.4 Ktx/sec
stdb_raw 💿 u32_u64_str btree_each_column 2048 256 581.5±33.47µs 575.2±40.61µs 1719 tx/sec 1738 tx/sec
stdb_raw 💿 u32_u64_str unique_0 2048 256 498.6±45.85µs 491.4±20.72µs 2005 tx/sec 2035 tx/sec
stdb_raw 💿 u32_u64_u64 btree_each_column 2048 256 377.7±5.14µs 389.0±7.36µs 2.6 Ktx/sec 2.5 Ktx/sec
stdb_raw 💿 u32_u64_u64 unique_0 2048 256 354.1±16.94µs 350.7±9.43µs 2.8 Ktx/sec 2.8 Ktx/sec
stdb_raw 🧠 u32_u64_str btree_each_column 2048 256 305.5±0.24µs 306.9±0.24µs 3.2 Ktx/sec 3.2 Ktx/sec
stdb_raw 🧠 u32_u64_str unique_0 2048 256 237.1±0.51µs 236.1±0.30µs 4.1 Ktx/sec 4.1 Ktx/sec
stdb_raw 🧠 u32_u64_u64 btree_each_column 2048 256 242.6±0.38µs 245.7±0.19µs 4.0 Ktx/sec 4.0 Ktx/sec
stdb_raw 🧠 u32_u64_u64 unique_0 2048 256 218.0±0.21µs 217.9±0.11µs 4.5 Ktx/sec 4.5 Ktx/sec

iterate

db on disk schema indices new latency old latency new throughput old throughput
sqlite 💿 u32_u64_str unique_0 23.7±0.19µs 21.8±0.08µs 41.2 Ktx/sec 44.7 Ktx/sec
sqlite 💿 u32_u64_u64 unique_0 21.8±0.09µs 20.7±0.34µs 44.9 Ktx/sec 47.1 Ktx/sec
sqlite 🧠 u32_u64_str unique_0 21.3±0.13µs 19.3±0.21µs 45.9 Ktx/sec 50.7 Ktx/sec
sqlite 🧠 u32_u64_u64 unique_0 19.0±0.03µs 18.0±0.23µs 51.5 Ktx/sec 54.3 Ktx/sec
stdb_raw 💿 u32_u64_str unique_0 4.7±0.00µs 4.8±0.00µs 206.3 Ktx/sec 204.8 Ktx/sec
stdb_raw 💿 u32_u64_u64 unique_0 4.6±0.00µs 4.6±0.00µs 210.8 Ktx/sec 210.8 Ktx/sec
stdb_raw 🧠 u32_u64_str unique_0 4.7±0.00µs 4.8±0.00µs 206.1 Ktx/sec 204.7 Ktx/sec
stdb_raw 🧠 u32_u64_u64 unique_0 4.6±0.00µs 4.6±0.00µs 210.6 Ktx/sec 210.6 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 68.5±0.32µs 69.2±0.35µs 14.3 Ktx/sec 14.1 Ktx/sec
sqlite 💿 u64 index 2048 256 65.3±0.17µs 65.6±0.11µs 15.0 Ktx/sec 14.9 Ktx/sec
sqlite 🧠 string index 2048 256 65.4±0.21µs 65.6±0.26µs 14.9 Ktx/sec 14.9 Ktx/sec
sqlite 🧠 u64 index 2048 256 59.3±0.12µs 60.1±0.26µs 16.5 Ktx/sec 16.2 Ktx/sec
stdb_raw 💿 string index 2048 256 4.9±0.00µs 4.9±0.00µs 198.7 Ktx/sec 199.0 Ktx/sec
stdb_raw 💿 u64 index 2048 256 4.7±0.00µs 4.7±0.00µs 207.9 Ktx/sec 208.3 Ktx/sec
stdb_raw 🧠 string index 2048 256 4.9±0.00µs 4.9±0.00µs 198.8 Ktx/sec 198.8 Ktx/sec
stdb_raw 🧠 u64 index 2048 256 4.7±0.00µs 4.7±0.00µs 207.8 Ktx/sec 208.2 Ktx/sec

serialize

schema format count new latency old latency new throughput old throughput
u32_u64_str bflatn_to_bsatn_fast_path 100 3.3±0.01µs 3.2±0.00µs 29.2 Mtx/sec 29.4 Mtx/sec
u32_u64_str bflatn_to_bsatn_slow_path 100 3.0±0.01µs 3.1±0.01µs 31.8 Mtx/sec 31.0 Mtx/sec
u32_u64_str bsatn 100 2.4±0.01µs 2.4±0.02µs 39.8 Mtx/sec 39.8 Mtx/sec
u32_u64_str bsatn 100 40.5±0.14ns 40.5±0.11ns 2.3 Gtx/sec 2.3 Gtx/sec
u32_u64_str json 100 4.9±0.02µs 5.5±0.06µs 19.5 Mtx/sec 17.4 Mtx/sec
u32_u64_str json 100 7.1±0.04µs 7.1±0.05µs 13.5 Mtx/sec 13.4 Mtx/sec
u32_u64_str product_value 100 1018.2±8.39ns 1014.9±1.17ns 93.7 Mtx/sec 94.0 Mtx/sec
u32_u64_u64 bflatn_to_bsatn_fast_path 100 1146.7±14.29ns 1112.9±7.61ns 83.2 Mtx/sec 85.7 Mtx/sec
u32_u64_u64 bflatn_to_bsatn_slow_path 100 2.4±0.00µs 2.4±0.00µs 39.1 Mtx/sec 39.2 Mtx/sec
u32_u64_u64 bsatn 100 1728.6±54.57ns 1699.7±37.89ns 55.2 Mtx/sec 56.1 Mtx/sec
u32_u64_u64 bsatn 100 29.2±0.10ns 39.4±0.09ns 3.2 Gtx/sec 2.4 Gtx/sec
u32_u64_u64 json 100 3.2±0.03µs 3.1±0.01µs 29.4 Mtx/sec 31.0 Mtx/sec
u32_u64_u64 json 100 4.9±0.02µs 5.1±0.11µs 19.4 Mtx/sec 18.7 Mtx/sec
u32_u64_u64 product_value 100 1012.5±1.56ns 1015.3±1.61ns 94.2 Mtx/sec 93.9 Mtx/sec
u64_u64_u32 bflatn_to_bsatn_fast_path 100 929.8±1.06ns 897.5±2.97ns 102.6 Mtx/sec 106.3 Mtx/sec
u64_u64_u32 bflatn_to_bsatn_slow_path 100 2.5±0.03µs 2.4±0.00µs 38.8 Mtx/sec 39.1 Mtx/sec
u64_u64_u32 bsatn 100 1678.7±33.21ns 1714.8±33.64ns 56.8 Mtx/sec 55.6 Mtx/sec
u64_u64_u32 bsatn 100 708.2±0.53ns 750.9±3.75ns 134.7 Mtx/sec 127.0 Mtx/sec
u64_u64_u32 json 100 3.4±0.03µs 3.3±0.23µs 28.5 Mtx/sec 28.7 Mtx/sec
u64_u64_u32 json 100 5.0±0.00µs 5.0±0.04µs 19.1 Mtx/sec 18.9 Mtx/sec
u64_u64_u32 product_value 100 1016.0±0.56ns 1015.5±0.65ns 93.9 Mtx/sec 93.9 Mtx/sec

stdb_module_large_arguments

arg size new latency old latency new throughput old throughput
64KiB 103.4±8.08µs 117.8±10.67µs - -

stdb_module_print_bulk

line count new latency old latency new throughput old throughput
1 52.0±9.04µs 51.0±4.85µs - -
100 594.9±6.88µs 594.9±5.30µs - -
1000 5.5±0.08ms 3.3±0.10ms - -

remaining

name new latency old latency new throughput old throughput
special/db_game/circles/load=10 290.6±1.78µs 307.1±2.64µs - -
special/db_game/circles/load=100 291.0±1.32µs 306.9±2.42µs - -
special/db_game/ia_loop/load=10 0.0±0.00ns 0.0±0.00ns - -
special/db_game/ia_loop/load=100 0.0±0.00ns 0.0±0.00ns - -
sqlite/💿/update_bulk/u32_u64_str/unique_0/load=2048/count=256 55.8±0.30µs 53.9±0.22µs 17.5 Ktx/sec 18.1 Ktx/sec
sqlite/💿/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 47.6±0.47µs 46.3±0.17µs 20.5 Ktx/sec 21.1 Ktx/sec
sqlite/🧠/update_bulk/u32_u64_str/unique_0/load=2048/count=256 41.5±0.10µs 39.8±0.13µs 23.5 Ktx/sec 24.6 Ktx/sec
sqlite/🧠/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 37.2±0.17µs 35.4±0.12µs 26.3 Ktx/sec 27.6 Ktx/sec
stdb_module/💿/update_bulk/u32_u64_str/unique_0/load=2048/count=256 1283.3±11.12µs 1269.4±16.63µs 779 tx/sec 787 tx/sec
stdb_module/💿/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 1050.7±10.29µs 1035.3±4.27µs 951 tx/sec 965 tx/sec
stdb_raw/💿/update_bulk/u32_u64_str/unique_0/load=2048/count=256 637.2±29.61µs 530.4±18.23µs 1569 tx/sec 1885 tx/sec
stdb_raw/💿/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 491.8±10.17µs 451.3±11.91µs 2033 tx/sec 2.2 Ktx/sec
stdb_raw/🧠/update_bulk/u32_u64_str/unique_0/load=2048/count=256 373.1±0.52µs 369.8±0.84µs 2.6 Ktx/sec 2.6 Ktx/sec
stdb_raw/🧠/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 339.1±0.38µs 335.3±0.33µs 2.9 Ktx/sec 2.9 Ktx/sec

@github-actions
Copy link

@github-actions github-actions bot commented on 37087c2 Oct 10, 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 5395 5395 0.00% 5441 5441 0.00%
sqlite 5509 5509 0.00% 5871 5863 0.14%

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 75388 75388 0.00% 75674 75714 -0.05%
stdb_raw u32_u64_str no_index 64 128 2 string 117799 117799 0.00% 118261 118293 -0.03%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24061 24061 0.00% 24423 24423 0.00%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23029 23029 0.00% 23303 23323 -0.09%
sqlite u32_u64_str no_index 64 128 2 string 144677 144677 0.00% 146159 146163 -0.00%
sqlite u32_u64_str no_index 64 128 1 u64 124027 124027 0.00% 125345 125353 -0.01%
sqlite u32_u64_str btree_each_column 64 128 1 u64 131344 131344 0.00% 132730 132886 -0.12%
sqlite u32_u64_str btree_each_column 64 128 2 string 134482 134476 0.00% 136160 136190 -0.02%

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 896285 897762 -0.16% 954747 951922 0.30%
stdb_raw u32_u64_str btree_each_column 64 128 1049195 1046621 0.25% 1123627 1110905 1.15%
sqlite u32_u64_str unique_0 64 128 398158 398158 0.00% 416104 414884 0.29%
sqlite u32_u64_str btree_each_column 64 128 983475 983475 0.00% 1022605 1026985 -0.43%

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 152681 152681 0.00% 152759 152731 0.02%
stdb_raw u32_u64_str unique_0 64 15706 15706 0.00% 15752 15752 0.00%
sqlite u32_u64_str unique_0 1024 1046653 1046653 0.00% 1050109 1049949 0.02%
sqlite u32_u64_str unique_0 64 74799 74799 0.00% 75885 75797 0.12%

callgrind: serialize_product_value

count format total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
64 json 47374 47374 0.00% 49894 49898 -0.01%
64 bsatn 25716 25716 0.00% 27960 27960 0.00%
16 bsatn 8117 8117 0.00% 9443 9443 0.00%
16 json 12126 12126 0.00% 13894 13894 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 20410844 20624457 -1.04% 21249316 21377041 -0.60%
stdb_raw u32_u64_str unique_0 64 128 1302533 1301685 0.07% 1391641 1353877 2.79%
sqlite u32_u64_str unique_0 1024 1024 1802091 1802109 -0.00% 1811641 1811167 0.03%
sqlite u32_u64_str unique_0 64 128 128437 128437 0.00% 131281 131277 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 5405 5405 0.00% 5451 5451 0.00%
sqlite 5551 5551 0.00% 5977 5973 0.07%

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 75398 75398 0.00% 75672 75684 -0.02%
stdb_raw u32_u64_str no_index 64 128 2 string 117809 117809 0.00% 118283 118315 -0.03%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24071 24071 0.00% 24397 24413 -0.07%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23039 23039 0.00% 23297 23317 -0.09%
sqlite u32_u64_str no_index 64 128 1 u64 125948 125948 0.00% 127550 127578 -0.02%
sqlite u32_u64_str no_index 64 128 2 string 146598 146598 0.00% 148400 148400 0.00%
sqlite u32_u64_str btree_each_column 64 128 2 string 136598 136598 0.00% 138638 138710 -0.05%
sqlite u32_u64_str btree_each_column 64 128 1 u64 133440 133440 0.00% 135272 135340 -0.05%

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 845885 845162 0.09% 903725 900152 0.40%
stdb_raw u32_u64_str btree_each_column 64 128 997696 998513 -0.08% 1070296 1062357 0.75%
sqlite u32_u64_str unique_0 64 128 415695 415695 0.00% 433007 431963 0.24%
sqlite u32_u64_str btree_each_column 64 128 1021736 1021736 0.00% 1059542 1064070 -0.43%

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 152691 152691 0.00% 152729 152733 -0.00%
stdb_raw u32_u64_str unique_0 64 15716 15716 0.00% 15758 15754 0.03%
sqlite u32_u64_str unique_0 1024 1049721 1049721 0.00% 1053443 1053395 0.00%
sqlite u32_u64_str unique_0 64 76571 76577 -0.01% 77881 77831 0.06%

callgrind: serialize_product_value

count format total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
64 json 47374 47374 0.00% 49894 49898 -0.01%
64 bsatn 25716 25716 0.00% 27960 27960 0.00%
16 bsatn 8117 8117 0.00% 9443 9443 0.00%
16 json 12126 12126 0.00% 13894 13894 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 19330537 19328837 0.01% 20246887 20174509 0.36%
stdb_raw u32_u64_str unique_0 64 128 1255061 1254173 0.07% 1343013 1338183 0.36%
sqlite u32_u64_str unique_0 1024 1024 1809652 1809652 0.00% 1818326 1818306 0.00%
sqlite u32_u64_str unique_0 64 128 132563 132581 -0.01% 135603 135505 0.07%

Please sign in to comment.