Skip to content

Commit

Permalink
Update TableSchema & system tables to resemble ABI V9 (#1697)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazimuth authored Sep 25, 2024
1 parent a7e2321 commit c32f297
Show file tree
Hide file tree
Showing 60 changed files with 2,782 additions and 2,983 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spacetimedb-client-api = { path = "../client-api" }
spacetimedb-testing = { path = "../testing" }
spacetimedb-primitives = { path = "../primitives" }
spacetimedb-table = { path = "../table" }
spacetimedb-schema.workspace = true
spacetimedb-schema = { workspace = true, features = ["test"] }

anyhow.workspace = true
anymap.workspace = true
Expand Down
8 changes: 4 additions & 4 deletions crates/bench/benches/special.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ use spacetimedb_bench::{
schemas::{create_sequential, u32_u64_str, u32_u64_u64, u64_u64_u32, BenchTable, RandomTable},
spacetime_module::BENCHMARKS_MODULE,
};
use spacetimedb_lib::db::raw_def::RawTableDefV8;
use spacetimedb_lib::{sats, ProductValue};
use spacetimedb_schema::schema::TableSchema;
use spacetimedb_testing::modules::start_runtime;
use std::hint::black_box;
use std::time::{Duration, Instant};
use std::{hint::black_box, sync::Arc};

#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
Expand Down Expand Up @@ -155,9 +154,10 @@ fn serialize_benchmarks<
);
});

#[allow(deprecated)]
let mut table_schema = TableSchema::from_product_type(T::product_type());
table_schema.table_name = name.into();
let mut table = spacetimedb_table::table::Table::new(
TableSchema::from_def(0.into(), RawTableDefV8::from_product(name, T::product_type().clone())).into(),
Arc::new(table_schema),
spacetimedb_table::indexes::SquashedOffset::COMMITTED_STATE,
);
let mut blob_store = spacetimedb_table::blob_store::HashMapBlobStore::default();
Expand Down
7 changes: 5 additions & 2 deletions crates/bench/src/spacetime_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ impl BenchDatabase for SpacetimeModule {
.await
});

for thing in module.client.module.catalog().iter() {
log::trace!("SPACETIME_MODULE: LOADED: {} {:?}", thing.0, thing.1.ty());
for table in module.client.module.info.module_def.tables() {
log::trace!("SPACETIME_MODULE: LOADED TABLE: {:?}", table);
}
for reducer in module.client.module.info.module_def.reducers() {
log::trace!("SPACETIME_MODULE: LOADED REDUCER: {:?}", reducer);
}
Ok(SpacetimeModule {
runtime,
Expand Down
37 changes: 29 additions & 8 deletions crates/bench/src/spacetime_raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ use crate::{
};
use spacetimedb::db::relational_db::{tests_utils::TestDB, RelationalDB};
use spacetimedb::execution_context::ExecutionContext;
use spacetimedb_lib::db::raw_def::{RawIndexDefV8, RawTableDefV8};
use spacetimedb_lib::sats::AlgebraicValue;
use spacetimedb_primitives::{ColId, TableId};
use spacetimedb_primitives::{ColId, IndexId, TableId};
use spacetimedb_schema::{
def::{BTreeAlgorithm, IndexAlgorithm},
schema::{IndexSchema, TableSchema},
};
use std::hint::black_box;
use tempdir::TempDir;

Expand Down Expand Up @@ -38,21 +41,39 @@ impl BenchDatabase for SpacetimeRaw {
fn create_table<T: BenchTable>(&mut self, index_strategy: IndexStrategy) -> ResultBench<Self::TableId> {
let name = table_name::<T>(index_strategy);
self.db.with_auto_commit(&ExecutionContext::default(), |tx| {
let table_def = RawTableDefV8::from_product(&name, T::product_type());
let table_id = self.db.create_table(tx, table_def)?;
let mut table_schema = TableSchema::from_product_type(T::product_type());
table_schema.table_name = name.clone().into();
let table_id = self.db.create_table(tx, table_schema)?;
self.db.rename_table(tx, table_id, &name)?;
match index_strategy {
IndexStrategy::Unique0 => {
self.db
.create_index(tx, table_id, RawIndexDefV8::btree("id".into(), ColId(0), true))?;
self.db.create_index(
tx,
IndexSchema {
index_id: IndexId::SENTINEL,
table_id,
index_name: "id".into(),
index_algorithm: IndexAlgorithm::BTree(BTreeAlgorithm {
columns: ColId(0).into(),
}),
},
true,
)?;
}
IndexStrategy::NoIndex => (),
IndexStrategy::BTreeEachColumn => {
for (i, column) in T::product_type().elements.iter().enumerate() {
self.db.create_index(
tx,
table_id,
RawIndexDefV8::btree(column.name.clone().unwrap(), i, false),
IndexSchema {
index_id: IndexId::SENTINEL,
table_id,
index_name: column.name.clone().unwrap(),
index_algorithm: IndexAlgorithm::BTree(BTreeAlgorithm {
columns: ColId(i as _).into(),
}),
},
false,
)?;
}
}
Expand Down
5 changes: 3 additions & 2 deletions crates/cli/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use reqwest::{header, Client, RequestBuilder};
use serde::Deserialize;
use serde_json::value::RawValue;

use spacetimedb_lib::db::raw_def::v9::RawModuleDefV9;
use spacetimedb_lib::de::serde::DeserializeWrapper;
use spacetimedb_lib::sats::ProductType;
use spacetimedb_lib::{Address, RawModuleDefV8};
use spacetimedb_lib::Address;

static APP_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),);

Expand Down Expand Up @@ -50,7 +51,7 @@ impl ClientApi {
}

/// Reads the `ModuleDef` from the `schema` endpoint.
pub async fn module_def(&self) -> anyhow::Result<RawModuleDefV8> {
pub async fn module_def(&self) -> anyhow::Result<RawModuleDefV9> {
let res = self
.client
.get(self.con.db_uri("schema"))
Expand Down
18 changes: 7 additions & 11 deletions crates/cli/src/subcommands/generate/csharp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use std::ops::Deref;

use convert_case::{Case, Casing};
use spacetimedb_lib::sats::{AlgebraicType, AlgebraicTypeRef, ArrayType, ProductType, SumType};
use spacetimedb_lib::{ReducerDef, TableDesc};
use spacetimedb_lib::ReducerDef;
use spacetimedb_primitives::ColList;
use spacetimedb_schema::schema::TableSchema;

use super::code_indenter::CodeIndenter;
use super::{GenCtx, GenItem};
use super::{GenCtx, GenItem, TableDescHack};

fn scalar_or_string_name(b: &AlgebraicType) -> Option<&str> {
Some(match b {
Expand Down Expand Up @@ -279,17 +279,13 @@ pub fn autogen_csharp_tuple(ctx: &GenCtx, name: &str, tuple: &ProductType, names
}

#[allow(deprecated)]
pub fn autogen_csharp_table(ctx: &GenCtx, table: &TableDesc, namespace: &str) -> String {
pub fn autogen_csharp_table(ctx: &GenCtx, table: &TableDescHack, namespace: &str) -> String {
let tuple = ctx.typespace[table.data].as_product().unwrap();
autogen_csharp_product_table_common(
ctx,
csharp_typename(ctx, table.data),
tuple,
Some(
TableSchema::from_def(0.into(), table.schema.clone())
.validated()
.expect("Failed to generate table due to validation errors"),
),
Some(table.schema.clone()),
namespace,
)
}
Expand Down Expand Up @@ -317,7 +313,7 @@ fn autogen_csharp_product_table_common(
write!(
output,
" : SpacetimeDB.{parent}<{name}, {namespace}.ReducerEvent>",
parent = if schema.pk().is_some() {
parent = if schema.primary_key.is_some() {
"DatabaseTableWithPrimaryKey"
} else {
"DatabaseTable"
Expand Down Expand Up @@ -383,7 +379,7 @@ fn autogen_csharp_product_table_common(

// If this is a table, we want to generate event accessor and indexes
if let Some(schema) = &schema {
let constraints = schema.column_constraints();
let constraints = schema.backcompat_column_constraints();
let mut unique_indexes = Vec::new();
// Declare custom index dictionaries
for col in schema.columns() {
Expand Down Expand Up @@ -450,7 +446,7 @@ fn autogen_csharp_access_funcs_for_struct(
_table_name: &str,
schema: &TableSchema,
) {
let constraints = schema.column_constraints();
let constraints = schema.backcompat_column_constraints();
for col in schema.columns() {
let is_unique = constraints[&ColList::new(col.col_pos)].has_unique();

Expand Down
16 changes: 11 additions & 5 deletions crates/cli/src/subcommands/generate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ use spacetimedb::host::wasmtime::{Mem, MemView, WasmPointee as _};
use spacetimedb_data_structures::map::HashSet;
use spacetimedb_lib::de::serde::DeserializeWrapper;
use spacetimedb_lib::sats::{AlgebraicType, AlgebraicTypeRef, Typespace};
use spacetimedb_lib::{bsatn, RawModuleDefV8, TableDesc, TypeAlias};
use spacetimedb_lib::{bsatn, RawModuleDefV8, TypeAlias};
use spacetimedb_lib::{RawModuleDef, MODULE_ABI_MAJOR_VERSION};
use spacetimedb_primitives::errno;
use spacetimedb_schema;
use spacetimedb_schema::def::{ModuleDef, ReducerDef, ScopedTypeName, TableDef, TypeDef};
use spacetimedb_schema::identifier::Identifier;
use spacetimedb_schema::schema::TableSchema;
use spacetimedb_schema::schema::{Schema, TableSchema};
use std::fs;
use std::ops::Deref;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -254,8 +254,8 @@ pub fn generate(module: RawModuleDef, lang: Language, namespace: &str) -> anyhow
let tableset = module.tables().map(|t| t.product_type_ref).collect::<HashSet<_>>();
let tables = module
.tables()
.map(|table| TableDesc {
schema: TableSchema::from_module_def(table, 0.into()).into(),
.map(|table| TableDescHack {
schema: TableSchema::from_module_def(&module, table, (), 0.into()),
data: table.product_type_ref,
})
.sorted_by(|a, b| a.schema.table_name.cmp(&b.schema.table_name));
Expand Down Expand Up @@ -337,8 +337,14 @@ trait Lang {
fn generate_globals(&self, module: &ModuleDef, namespace: &str) -> Vec<(String, String)>;
}

/// Backwards-compatibible imitation of `TableDesc` that should be removed once the generators are updated to rely on `ModuleDef`.
pub struct TableDescHack {
schema: TableSchema,
data: AlgebraicTypeRef,
}

pub enum GenItem {
Table(TableDesc),
Table(TableDescHack),
TypeAlias(TypeAlias),
Reducer(spacetimedb_lib::ReducerDef),
}
Expand Down
14 changes: 7 additions & 7 deletions crates/cli/src/subcommands/generate/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use spacetimedb_lib::sats::AlgebraicTypeRef;
use spacetimedb_primitives::ColList;
use spacetimedb_schema::def::{ModuleDef, ReducerDef, ScopedTypeName, TableDef, TypeDef};
use spacetimedb_schema::identifier::Identifier;
use spacetimedb_schema::schema::TableSchema;
use spacetimedb_schema::schema::{Schema, TableSchema};
use spacetimedb_schema::type_for_generate::{
AlgebraicTypeDef, AlgebraicTypeUse, PlainEnumTypeDef, PrimitiveType, ProductTypeDef, SumTypeDef,
};
Expand Down Expand Up @@ -304,7 +304,7 @@ pub fn autogen_rust_table(module: &ModuleDef, table: &TableDef) -> String {

out.newline();

let table = TableSchema::from_module_def(table, 0.into())
let table = TableSchema::from_module_def(module, table, (), 0.into())
.validated()
.expect("Failed to generate table due to validation errors");
print_impl_tabletype(module, out, &type_name, product_def, &table);
Expand Down Expand Up @@ -430,7 +430,7 @@ fn print_table_filter_methods(
table: &TableSchema,
) {
write!(out, "impl {table_type_name} ");
let constraints = table.column_constraints();
let constraints = table.backcompat_column_constraints();
out.delimited_block(
"{",
|out| {
Expand Down Expand Up @@ -796,8 +796,8 @@ fn print_handle_table_update_defn(module: &ModuleDef, out: &mut Indenter) {
out.delimited_block(
"match table_name {",
|out| {
for table_desc in iter_tables(module) {
let table = TableSchema::from_module_def(table_desc, 0.into()).validated().unwrap();
for table_def in iter_tables(module) {
let table = TableSchema::from_module_def(module, table_def, (), 0.into()).validated().unwrap();
writeln!(
out,
"{:?} => client_cache.{}::<{}::{}>(callbacks, table_update),",
Expand All @@ -807,8 +807,8 @@ fn print_handle_table_update_defn(module: &ModuleDef, out: &mut Indenter) {
} else {
"handle_table_update_no_primary_key"
},
type_name(module, table_desc.product_type_ref).to_case(Case::Snake),
type_name(module, table_desc.product_type_ref).to_case(Case::Pascal),
type_name(module, table_def.product_type_ref).to_case(Case::Snake),
type_name(module, table_def.product_type_ref).to_case(Case::Pascal),
);
}
writeln!(
Expand Down
10 changes: 5 additions & 5 deletions crates/cli/src/subcommands/generate/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ use spacetimedb_lib::sats::product_type::IDENTITY_TAG;
use spacetimedb_lib::sats::{
AlgebraicType, AlgebraicTypeRef, ArrayType, ProductType, ProductTypeElement, SumType, SumTypeVariant,
};
use spacetimedb_lib::{ReducerDef, TableDesc};
use spacetimedb_lib::ReducerDef;
use spacetimedb_primitives::ColList;
use spacetimedb_schema::schema::TableSchema;

use super::code_indenter::CodeIndenter;
use super::{GenCtx, GenItem, INDENT};
use super::{GenCtx, GenItem, TableDescHack, INDENT};

fn scalar_or_string_to_ts(ty: &AlgebraicType) -> Option<(&str, &str)> {
Some(match ty {
Expand Down Expand Up @@ -499,13 +499,13 @@ pub fn autogen_typescript_tuple(ctx: &GenCtx, name: &str, tuple: &ProductType) -
autogen_typescript_product_table_common(ctx, name, tuple, None)
}
#[allow(deprecated)]
pub fn autogen_typescript_table(ctx: &GenCtx, table: &TableDesc) -> String {
pub fn autogen_typescript_table(ctx: &GenCtx, table: &TableDescHack) -> String {
let tuple = ctx.typespace[table.data].as_product().unwrap();
autogen_typescript_product_table_common(
ctx,
typescript_typename(ctx, table.data),
tuple,
Some(TableSchema::from_def(0.into(), table.schema.clone())),
Some(table.schema.clone()),
)
}

Expand Down Expand Up @@ -767,7 +767,7 @@ fn autogen_typescript_access_funcs_for_struct(
table_name: &str,
table: &TableSchema,
) {
let constraints = table.column_constraints();
let constraints = table.backcompat_column_constraints();
for col in table.columns() {
let is_unique = constraints[&ColList::new(col.col_pos)].has_unique();
let field = &product_type.elements[col.col_pos.idx()];
Expand Down
12 changes: 6 additions & 6 deletions crates/cli/src/subcommands/subscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use http::uri::Scheme;
use serde_json::Value;
use spacetimedb_client_api_messages::websocket::{self as ws, EncodedValue};
use spacetimedb_data_structures::map::HashMap;
use spacetimedb_lib::db::raw_def::v9::RawModuleDefV9;
use spacetimedb_lib::de::serde::{DeserializeWrapper, SeedWrapper};
use spacetimedb_lib::ser::serde::SerializeWrapper;
use spacetimedb_lib::RawModuleDefV8;
use spacetimedb_standalone::TEXT_PROTOCOL;
use std::time::Duration;
use tokio::io::AsyncWriteExt;
Expand Down Expand Up @@ -92,17 +92,17 @@ fn parse_msg_json(msg: &WsMessage) -> Option<ws::ServerMessage> {

fn reformat_update(
msg: ws::DatabaseUpdate,
schema: &RawModuleDefV8,
schema: &RawModuleDefV9,
) -> anyhow::Result<HashMap<String, SubscriptionTable>> {
msg.tables
.into_iter()
.map(|upd| {
let table_schema = schema
.tables
.iter()
.find(|tbl| tbl.schema.table_name.as_ref() == upd.table_name)
.find(|tbl| tbl.name.as_ref() == upd.table_name)
.context("table not found in schema")?;
let table_ty = schema.typespace.resolve(table_schema.data);
let table_ty = schema.typespace.resolve(table_schema.product_type_ref);

let reformat_row = |row: EncodedValue| {
let EncodedValue::Text(row) = row else {
Expand Down Expand Up @@ -208,7 +208,7 @@ where

/// Await the initial [`ServerMessage::SubscriptionUpdate`].
/// If `module_def` is `Some`, print a JSON representation to stdout.
async fn await_initial_update<S>(ws: &mut S, module_def: Option<&RawModuleDefV8>) -> anyhow::Result<()>
async fn await_initial_update<S>(ws: &mut S, module_def: Option<&RawModuleDefV9>) -> anyhow::Result<()>
where
S: TryStream<Ok = WsMessage> + Unpin,
S::Error: std::error::Error + Send + Sync + 'static,
Expand Down Expand Up @@ -243,7 +243,7 @@ where
async fn consume_transaction_updates<S>(
ws: &mut S,
num: Option<u32>,
module_def: &RawModuleDefV8,
module_def: &RawModuleDefV9,
) -> anyhow::Result<bool>
where
S: TryStream<Ok = WsMessage> + Unpin,
Expand Down
Loading

2 comments on commit c32f297

@github-actions
Copy link

@github-actions github-actions bot commented on c32f297 Sep 25, 2024

Choose a reason for hiding this comment

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

Benchmarking failed. Please check the workflow run for details.

@github-actions
Copy link

@github-actions github-actions bot commented on c32f297 Sep 25, 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 5376 5380 -0.07% 5418 5414 0.07%
sqlite 5555 5555 0.00% 6077 5947 2.19%

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 2 string 117778 119003 -1.03% 118180 119633 -1.21%
stdb_raw u32_u64_str no_index 64 128 1 u64 75366 75374 -0.01% 75612 75884 -0.36%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24034 22611 6.29% 24496 23137 5.87%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23001 21578 6.59% 23295 22068 5.56%
sqlite u32_u64_str no_index 64 128 2 string 144678 144677 0.00% 146258 146137 0.08%
sqlite u32_u64_str no_index 64 128 1 u64 124027 124036 -0.01% 125283 125358 -0.06%
sqlite u32_u64_str btree_each_column 64 128 2 string 134477 134476 0.00% 136129 136116 0.01%
sqlite u32_u64_str btree_each_column 64 128 1 u64 131354 131343 0.01% 132770 132767 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 902819 898674 0.46% 955579 950608 0.52%
stdb_raw u32_u64_str btree_each_column 64 128 1055763 1052711 0.29% 1120033 1119063 0.09%
sqlite u32_u64_str unique_0 64 128 398292 398292 0.00% 413336 416704 -0.81%
sqlite u32_u64_str btree_each_column 64 128 983619 983609 0.00% 1028139 1024421 0.36%

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 152662 152676 -0.01% 152708 152814 -0.07%
stdb_raw u32_u64_str unique_0 64 15687 15701 -0.09% 15721 15835 -0.72%
sqlite u32_u64_str unique_0 1024 1068223 1068223 0.00% 1071651 1071387 0.02%
sqlite u32_u64_str unique_0 64 76227 76209 0.02% 77361 77059 0.39%

callgrind: serialize_product_value

count format total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
64 json 47118 47182 -0.14% 49804 49800 0.01%
64 bsatn 25716 25716 0.00% 27960 27994 -0.12%
16 json 12062 12078 -0.13% 14000 13948 0.37%
16 bsatn 8117 8117 0.00% 9443 9477 -0.36%

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 20712246 20571217 0.69% 21274524 21319239 -0.21%
stdb_raw u32_u64_str unique_0 64 128 1307333 1296962 0.80% 1344279 1379794 -2.57%
sqlite u32_u64_str unique_0 1024 1024 1801977 1802006 -0.00% 1811227 1811066 0.01%
sqlite u32_u64_str unique_0 64 128 128323 128352 -0.02% 131151 130994 0.12%
On-disk benchmarks

callgrind: empty transaction

db total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw 5386 5390 -0.07% 5432 5428 0.07%
sqlite 5597 5613 -0.29% 6183 6133 0.82%

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 2 string 117788 117924 -0.12% 118182 118586 -0.34%
stdb_raw u32_u64_str no_index 64 128 1 u64 75376 75384 -0.01% 75614 75910 -0.39%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24044 22621 6.29% 24502 23139 5.89%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23011 21588 6.59% 23293 22074 5.52%
sqlite u32_u64_str no_index 64 128 2 string 146599 146598 0.00% 148487 148362 0.08%
sqlite u32_u64_str no_index 64 128 1 u64 125948 125947 0.00% 127500 127503 -0.00%
sqlite u32_u64_str btree_each_column 64 128 2 string 136599 136598 0.00% 138681 138748 -0.05%
sqlite u32_u64_str btree_each_column 64 128 1 u64 133440 133439 0.00% 135226 135289 -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 851903 847362 0.54% 903723 867798 4.14%
stdb_raw u32_u64_str btree_each_column 64 128 1002827 997061 0.58% 1066581 1063221 0.32%
sqlite u32_u64_str unique_0 64 128 415829 415829 0.00% 430339 433543 -0.74%
sqlite u32_u64_str btree_each_column 64 128 1021876 1021870 0.00% 1065444 1061642 0.36%

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 152672 152686 -0.01% 152734 152820 -0.06%
stdb_raw u32_u64_str unique_0 64 15697 15711 -0.09% 15759 15845 -0.54%
sqlite u32_u64_str unique_0 1024 1071291 1071291 0.00% 1075049 1074861 0.02%
sqlite u32_u64_str unique_0 64 78014 77981 0.04% 79296 79095 0.25%

callgrind: serialize_product_value

count format total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
64 json 47118 47182 -0.14% 49804 49800 0.01%
64 bsatn 25716 25716 0.00% 27960 27994 -0.12%
16 json 12062 12078 -0.13% 14000 13948 0.37%
16 bsatn 8117 8117 0.00% 9443 9477 -0.36%

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 19416795 19295779 0.63% 19999559 20160823 -0.80%
stdb_raw u32_u64_str unique_0 64 128 1259973 1253212 0.54% 1327791 1338488 -0.80%
sqlite u32_u64_str unique_0 1024 1024 1809538 1809567 -0.00% 1818328 1818163 0.01%
sqlite u32_u64_str unique_0 64 128 132449 132478 -0.02% 135381 135336 0.03%

Please sign in to comment.