Skip to content

Commit

Permalink
Remove abi functions that are no longer needed (#1777)
Browse files Browse the repository at this point in the history
  • Loading branch information
coolreader18 authored Oct 1, 2024
1 parent 5ee077e commit 039c7e2
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 247 deletions.
115 changes: 1 addition & 114 deletions crates/bindings-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,54 +166,6 @@ pub mod raw {
out: *mut RowIter,
) -> u16;

/// Finds all rows in the table identified by `table_id`,
/// where the row has a column, identified by `col_id`,
/// with data matching the byte string, in WASM memory, pointed to at by `val`.
///
/// Matching is defined BSATN-decoding `val` to an `AlgebraicValue`
/// according to the column's schema and then `Ord for AlgebraicValue`.
///
/// On success, the iterator handle is written to the `out` pointer.
///
/// Returns an error if
/// - a table with the provided `table_id` doesn't exist
/// - `col_id` does not identify a column of the table,
/// - `(val, val_len)` cannot be decoded to an `AlgebraicValue`
/// typed at the `AlgebraicType` of the column,
/// - `val + val_len` overflows a 64-bit integer
pub fn iter_by_col_eq(
table_id: TableId,
col_id: ColId,
val: *const u8,
val_len: usize,
out: *mut RowIter,
) -> u16;

/// Deletes all rows in the table identified by `table_id`
/// where the column identified by `col_id` matches the byte string,
/// in WASM memory, pointed to at by `value`.
///
/// Matching is defined by BSATN-decoding `value` to an `AlgebraicValue`
/// according to the column's schema and then `Ord for AlgebraicValue`.
///
/// The number of rows deleted is written to the WASM pointer `out`.
///
/// Returns an error if
/// - a table with the provided `table_id` doesn't exist
/// - no columns were deleted
/// - `col_id` does not identify a column of the table,
/// - `(value, value_len)` doesn't decode from BSATN to an `AlgebraicValue`
/// according to the `AlgebraicType` that the table's schema specifies for `col_id`.
/// - `value + value_len` overflows a 64-bit integer
/// - writing to `out` would overflow a 32-bit integer
pub fn delete_by_col_eq(
table_id: TableId,
col_id: ColId,
value: *const u8,
value_len: usize,
out: *mut u32,
) -> u16;

/// Deletes all rows found in the index identified by `index_id`,
/// according to the:
/// - `prefix = prefix_ptr[..prefix_len]`,
Expand Down Expand Up @@ -295,21 +247,6 @@ pub mod raw {
out: *mut u32,
) -> u16;

/// Like [`_datastore_table_scan_bsatn`], start iteration on each row,
/// as bytes, of a table identified by `table_id`.
///
/// The rows are filtered through `filter`, which is read from WASM memory
/// and is encoded in the embedded language defined by `spacetimedb_lib::filter::Expr`.
///
/// The iterator is registered in the host environment
/// under an assigned index which is written to the `out` pointer provided.
///
/// Returns an error if
/// - a table with the provided `table_id` doesn't exist
/// - `(filter, filter_len)` doesn't decode to a filter expression
/// - `filter + filter_len` overflows a 64-bit integer
pub fn iter_start_filtered(table_id: TableId, filter: *const u8, filter_len: usize, out: *mut RowIter) -> u16;

/// Reads rows from the given iterator registered under `iter`.
///
/// Takes rows from the iterator
Expand Down Expand Up @@ -776,28 +713,6 @@ pub fn datastore_table_row_count(table_id: TableId) -> Result<u64, Errno> {
unsafe { call(|out| raw::datastore_table_row_count(table_id, out)) }
}

/// Finds all rows in the table identified by `table_id`,
/// where the row has a column, identified by `col_id`,
/// with data matching the byte string `val`.
///
/// Matching is defined BSATN-decoding `val` to an `AlgebraicValue`
/// according to the column's schema and then `Ord for AlgebraicValue`.
///
/// The rows found are BSATN encoded and then concatenated.
/// The resulting byte string from the concatenation is written
/// to a fresh buffer with a handle to it returned as a `Buffer`.
///
/// Returns an error if
/// - a table with the provided `table_id` doesn't exist
/// - `col_id` does not identify a column of the table
/// - `val` cannot be BSATN-decoded to an `AlgebraicValue`
/// typed at the `AlgebraicType` of the column
#[inline]
pub fn iter_by_col_eq(table_id: TableId, col_id: ColId, val: &[u8]) -> Result<RowIter, Errno> {
let raw = unsafe { call(|out| raw::iter_by_col_eq(table_id, col_id, val.as_ptr(), val.len(), out)) }?;
Ok(RowIter { raw })
}

/// Inserts a row into the table identified by `table_id`,
/// where the row is a BSATN-encoded `ProductValue`
/// matching the table's `ProductType` row-schema.
Expand All @@ -811,29 +726,12 @@ pub fn iter_by_col_eq(table_id: TableId, col_id: ColId, val: &[u8]) -> Result<Ro
/// - `row` doesn't decode from BSATN to a `ProductValue`
/// according to the `ProductType` that the table's schema specifies.
#[inline]
pub fn insert(table_id: TableId, row: &mut [u8]) -> Result<&[u8], Errno> {
pub fn datastore_insert_bsatn(table_id: TableId, row: &mut [u8]) -> Result<&[u8], Errno> {
let row_ptr = row.as_mut_ptr();
let row_len = &mut row.len();
cvt(unsafe { raw::datastore_insert_bsatn(table_id, row_ptr, row_len) }).map(|()| &row[..*row_len])
}

/// Deletes all rows in the table identified by `table_id`
/// where the column identified by `col_id` matches `value`.
///
/// Matching is defined by BSATN-decoding `value` to an `AlgebraicValue`
/// according to the column's schema and then `Ord for AlgebraicValue`.
///
/// Returns the number of rows deleted.
///
/// Returns an error if
/// - a table with the provided `table_id` doesn't exist
/// - no columns were deleted
/// - `col_id` does not identify a column of the table
#[inline]
pub fn delete_by_col_eq(table_id: TableId, col_id: ColId, value: &[u8]) -> Result<u32, Errno> {
unsafe { call(|out| raw::delete_by_col_eq(table_id, col_id, value.as_ptr(), value.len(), out)) }
}

/// Deletes those rows, in the table identified by `table_id`,
/// that match any row in the byte string `relation`.
///
Expand Down Expand Up @@ -995,17 +893,6 @@ pub fn datastore_delete_by_btree_scan_bsatn(
}
}

/// Iterate through a table, filtering by an encoded `spacetimedb_lib::filter::Expr`.
///
/// # Errors
///
/// - `NO_SUCH_TABLE`, if `table_id` doesn't exist.
#[inline]
pub fn iter_filtered(table_id: TableId, filter: &[u8]) -> Result<RowIter, Errno> {
let raw = unsafe { call(|out| raw::iter_start_filtered(table_id, filter.as_ptr(), filter.len(), out))? };
Ok(RowIter { raw })
}

/// A log level that can be used in `console_log`.
/// The variants are convertible into a raw `u8` log level.
#[repr(u8)]
Expand Down
2 changes: 1 addition & 1 deletion crates/bindings/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ fn insert<T: Table>(mut row: T::Row, mut buf: IterBuf) -> Result<T::Row, TryInse

// Insert row into table.
// When table has an auto-incrementing column, we must re-decode the changed `buf`.
let res = sys::insert(table_id, &mut buf).map(|gen_cols| {
let res = sys::datastore_insert_bsatn(table_id, &mut buf).map(|gen_cols| {
// Let the caller handle any generated columns written back by `sys::insert` to `buf`.
T::integrate_generated_columns(&mut row, gen_cols);
row
Expand Down
4 changes: 0 additions & 4 deletions crates/core/src/host/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,5 @@ pub enum AbiCall {
ConsoleTimerStart,
ConsoleTimerEnd,

DeleteByColEq,
IterByColEq,
IterStartFiltered,

VolatileNonatomicScheduleImmediate,
}
8 changes: 3 additions & 5 deletions crates/core/src/host/wasm_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,12 @@ macro_rules! abi_funcs {
"spacetime_10.0"::console_log,
"spacetime_10.0"::console_timer_start,
"spacetime_10.0"::console_timer_end,

"spacetime_10.0"::delete_by_col_eq,
"spacetime_10.0"::iter_by_col_eq,
"spacetime_10.0"::iter_start_filtered,
"spacetime_10.0"::volatile_nonatomic_schedule_immediate,
"spacetime_10.0"::index_id_from_name,
"spacetime_10.0"::datastore_btree_scan_bsatn,
"spacetime_10.0"::datastore_delete_by_btree_scan_bsatn,

// unstable:
"spacetime_10.0"::volatile_nonatomic_schedule_immediate,
}
};
}
Expand Down
123 changes: 0 additions & 123 deletions crates/core/src/host/wasmtime/wasm_instance_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,44 +291,6 @@ impl WasmInstanceEnv {
Ok(col_id.into())
}

/// Deletes all rows in the table identified by `table_id`
/// where the column identified by `cols` matches the byte string,
/// in WASM memory, pointed to at by `value`.
///
/// Matching is defined by BSATN-decoding `value` to an `AlgebraicValue`
/// according to the column's schema and then `Ord for AlgebraicValue`.
///
/// The number of rows deleted is written to the WASM pointer `out`.
///
/// Returns an error if
/// - a table with the provided `table_id` doesn't exist
/// - no columns were deleted
/// - `col_id` does not identify a column of the table,
/// - `(value, value_len)` doesn't decode from BSATN to an `AlgebraicValue`
/// according to the `AlgebraicType` that the table's schema specifies for `col_id`.
/// - `value + value_len` overflows a 64-bit integer
/// - writing to `out` would overflow a 32-bit integer
pub fn delete_by_col_eq(
caller: Caller<'_, Self>,
table_id: u32,
col_id: u32,
value: WasmPtr<u8>,
value_len: u32,
out: WasmPtr<u32>,
) -> RtResult<u32> {
Self::cvt_ret(caller, AbiCall::DeleteByColEq, out, |caller| {
let col_id = Self::convert_u32_to_col_id(col_id)?;

let (mem, env) = Self::mem_env(caller);
let ctx = env.reducer_context()?;
let value = mem.deref_slice(value, value_len)?;
let count = env
.instance_env
.delete_by_col_eq(&ctx, table_id.into(), col_id, value)?;
Ok(count)
})
}

/// Queries the `table_id` associated with the given (table) `name`
/// where `name` is the UTF-8 slice in WASM memory at `name_ptr[..name_len]`.
///
Expand Down Expand Up @@ -557,91 +519,6 @@ impl WasmInstanceEnv {
})
}

/// Finds all rows in the table identified by `table_id`,
/// where the row has a column, identified by `cols`,
/// with data matching the byte string, in WASM memory, pointed to at by `val`.
///
/// Matching is defined BSATN-decoding `val` to an `AlgebraicValue`
/// according to the column's schema and then `Ord for AlgebraicValue`.
///
/// The rows found are BSATN-encoded and then concatenated.
/// The resulting byte string from the concatenation is written
/// to a fresh buffer with the buffer's identifier written to the WASM pointer `out`.
///
/// Returns an error if
/// - a table with the provided `table_id` doesn't exist
/// - `col_id` does not identify a column of the table,
/// - `(val, val_len)` cannot be decoded to an `AlgebraicValue`
/// typed at the `AlgebraicType` of the column,
/// - `val + val_len` overflows a 64-bit integer
pub fn iter_by_col_eq(
caller: Caller<'_, Self>,
table_id: u32,
col_id: u32,
val: WasmPtr<u8>,
val_len: u32,
out: WasmPtr<RowIterIdx>,
) -> RtResult<u32> {
Self::cvt_ret(caller, AbiCall::IterByColEq, out, |caller| {
let col_id = Self::convert_u32_to_col_id(col_id)?;

let (mem, env) = Self::mem_env(caller);
// Read the test value from WASM memory.
let value = mem.deref_slice(val, val_len)?;

// Retrieve the execution context for the current reducer.
let ctx = env.reducer_context()?;

// Find the relevant rows.
let chunks = env
.instance_env
.iter_by_col_eq_chunks(&ctx, table_id.into(), col_id, value)?;

// Release the immutable borrow of `env.buffers` by dropping `ctx`.
drop(ctx);

// Insert the encoded + concatenated rows into a new buffer and return its id.
Ok(env.iters.insert(chunks.into_iter()))
})
}

/// Like [`WasmInstanceEnv::datastore_table_scan_bsatn`], start iteration on each row,
/// as bytes, of a table identified by `table_id`.
///
/// The rows are filtered through `filter`, which is read from WASM memory
/// and is encoded in the embedded language defined by `spacetimedb_lib::filter::Expr`.
///
/// The iterator is registered in the host environment
/// under an assigned index which is written to the `out` pointer provided.
///
/// Returns an error if
/// - a table with the provided `table_id` doesn't exist
/// - `(filter, filter_len)` doesn't decode to a filter expression
/// - `filter + filter_len` overflows a 64-bit integer
pub fn iter_start_filtered(
caller: Caller<'_, Self>,
table_id: u32,
filter: WasmPtr<u8>,
filter_len: u32,
out: WasmPtr<RowIterIdx>,
) -> RtResult<u32> {
Self::cvt_ret(caller, AbiCall::IterStartFiltered, out, |caller| {
let (mem, env) = Self::mem_env(caller);
// Retrieve the execution context for the current reducer.
let ctx = env.reducer_context()?;

// Read the slice `(filter, filter_len)`.
let filter = mem.deref_slice(filter, filter_len)?;

// Construct the iterator.
let chunks = env.instance_env.iter_filtered_chunks(&ctx, table_id.into(), filter)?;
drop(ctx);
// Register the iterator and get back the index to write to `out`.
// Calls to the iterator are done through dynamic dispatch.
Ok(env.iters.insert(chunks.into_iter()))
})
}

/// Reads rows from the given iterator registered under `iter`.
///
/// Takes rows from the iterator
Expand Down

2 comments on commit 039c7e2

@github-actions
Copy link

@github-actions github-actions bot commented on 039c7e2 Oct 1, 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 5408 -0.24% 5441 5458 -0.31%
sqlite 5509 5509 0.00% 5927 5959 -0.54%

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 117799 117812 -0.01% 118405 118376 0.02%
stdb_raw u32_u64_str no_index 64 128 1 u64 75388 75401 -0.02% 75818 75819 -0.00%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24055 24069 -0.06% 24533 24505 0.11%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23023 23036 -0.06% 23449 23422 0.12%
sqlite u32_u64_str no_index 64 128 2 string 144619 144637 -0.01% 146003 146009 -0.00%
sqlite u32_u64_str no_index 64 128 1 u64 124017 124017 0.00% 125223 125249 -0.02%
sqlite u32_u64_str btree_each_column 64 128 2 string 134418 134418 0.00% 136082 136022 0.04%
sqlite u32_u64_str btree_each_column 64 128 1 u64 131352 131334 0.01% 132844 132664 0.14%

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 900088 900469 -0.04% 962228 973713 -1.18%
stdb_raw u32_u64_str btree_each_column 64 128 1055327 1051154 0.40% 1098963 1137572 -3.39%
sqlite u32_u64_str unique_0 64 128 398156 398156 0.00% 417990 415488 0.60%
sqlite u32_u64_str btree_each_column 64 128 983483 983483 0.00% 1019693 1025293 -0.55%

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 152694 -0.01% 152765 152772 -0.00%
stdb_raw u32_u64_str unique_0 64 15706 15719 -0.08% 15790 15789 0.01%
sqlite u32_u64_str unique_0 1024 1046653 1046659 -0.00% 1049997 1050135 -0.01%
sqlite u32_u64_str unique_0 64 74799 74799 0.00% 75789 75843 -0.07%

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% 50132 49890 0.49%
64 bsatn 25716 25716 0.00% 27994 27960 0.12%
16 json 12126 12126 0.00% 14098 13860 1.72%
16 bsatn 8117 8117 0.00% 9511 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 20438605 20664934 -1.10% 21252103 21497212 -1.14%
stdb_raw u32_u64_str unique_0 64 128 1304046 1305041 -0.08% 1360686 1393771 -2.37%
sqlite u32_u64_str unique_0 1024 1024 1802101 1802101 0.00% 1811543 1811463 0.00%
sqlite u32_u64_str unique_0 64 128 128447 128447 0.00% 131221 131187 0.03%
On-disk benchmarks

callgrind: empty transaction

db total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw 5405 5418 -0.24% 5451 5472 -0.38%
sqlite 5551 5551 0.00% 6033 6065 -0.53%

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 117809 117822 -0.01% 118403 118350 0.04%
stdb_raw u32_u64_str no_index 64 128 1 u64 75398 75411 -0.02% 75824 75801 0.03%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24067 24080 -0.05% 24541 24512 0.12%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23033 23046 -0.06% 23455 23400 0.24%
sqlite u32_u64_str no_index 64 128 2 string 146540 146540 0.00% 148356 148188 0.11%
sqlite u32_u64_str no_index 64 128 1 u64 125928 125928 0.00% 127480 127434 0.04%
sqlite u32_u64_str btree_each_column 64 128 2 string 136540 136540 0.00% 138702 138558 0.10%
sqlite u32_u64_str btree_each_column 64 128 1 u64 133420 133420 0.00% 135334 135248 0.06%

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 848575 849378 -0.09% 910257 921912 -1.26%
stdb_raw u32_u64_str btree_each_column 64 128 1001315 1001457 -0.01% 1075231 1088343 -1.20%
sqlite u32_u64_str unique_0 64 128 415693 415693 0.00% 434867 432435 0.56%
sqlite u32_u64_str btree_each_column 64 128 1021734 1021734 0.00% 1056614 1063946 -0.69%

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 152704 -0.01% 152771 152774 -0.00%
stdb_raw u32_u64_str unique_0 64 15716 15729 -0.08% 15796 15799 -0.02%
sqlite u32_u64_str unique_0 1024 1049721 1049721 0.00% 1053443 1053497 -0.01%
sqlite u32_u64_str unique_0 64 76571 76589 -0.02% 77841 77841 0.00%

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% 50132 49890 0.49%
64 bsatn 25716 25716 0.00% 27994 27960 0.12%
16 json 12126 12126 0.00% 14098 13860 1.72%
16 bsatn 8117 8117 0.00% 9511 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 19357785 19370175 -0.06% 20250223 20278849 -0.14%
stdb_raw u32_u64_str unique_0 64 128 1256387 1257423 -0.08% 1342249 1344631 -0.18%
sqlite u32_u64_str unique_0 1024 1024 1809652 1809652 0.00% 1818234 1818162 0.00%
sqlite u32_u64_str unique_0 64 128 132563 132563 0.00% 135573 135419 0.11%

@github-actions
Copy link

@github-actions github-actions bot commented on 039c7e2 Oct 1, 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 💿 408.8±1.26ns 428.7±2.06ns - -
sqlite 🧠 402.7±0.97ns 417.6±2.79ns - -
stdb_raw 💿 634.7±1.27ns 625.1±1.03ns - -
stdb_raw 🧠 634.3±1.06ns 628.1±1.53ns - -

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 578.6±0.76µs 584.3±0.81µs 1728 tx/sec 1711 tx/sec
sqlite 💿 u32_u64_str unique_0 2048 256 147.3±0.91µs 150.8±0.79µs 6.6 Ktx/sec 6.5 Ktx/sec
sqlite 💿 u32_u64_u64 btree_each_column 2048 256 459.5±0.63µs 469.8±1.07µs 2.1 Ktx/sec 2.1 Ktx/sec
sqlite 💿 u32_u64_u64 unique_0 2048 256 139.8±14.84µs 136.5±0.83µs 7.0 Ktx/sec 7.2 Ktx/sec
sqlite 🧠 u32_u64_str btree_each_column 2048 256 439.5±0.66µs 450.2±2.80µs 2.2 Ktx/sec 2.2 Ktx/sec
sqlite 🧠 u32_u64_str unique_0 2048 256 119.2±0.86µs 124.1±0.98µs 8.2 Ktx/sec 7.9 Ktx/sec
sqlite 🧠 u32_u64_u64 btree_each_column 2048 256 359.3±0.77µs 366.7±0.22µs 2.7 Ktx/sec 2.7 Ktx/sec
sqlite 🧠 u32_u64_u64 unique_0 2048 256 104.1±0.41µs 102.0±1.01µs 9.4 Ktx/sec 9.6 Ktx/sec
stdb_raw 💿 u32_u64_str btree_each_column 2048 256 640.3±18.38µs 588.8±19.43µs 1561 tx/sec 1698 tx/sec
stdb_raw 💿 u32_u64_str unique_0 2048 256 490.7±38.89µs 448.8±38.32µs 2037 tx/sec 2.2 Ktx/sec
stdb_raw 💿 u32_u64_u64 btree_each_column 2048 256 383.8±6.76µs 382.7±8.90µs 2.5 Ktx/sec 2.6 Ktx/sec
stdb_raw 💿 u32_u64_u64 unique_0 2048 256 350.9±8.03µs 360.7±6.79µs 2.8 Ktx/sec 2.7 Ktx/sec
stdb_raw 🧠 u32_u64_str btree_each_column 2048 256 305.2±0.13µs 313.8±0.36µs 3.2 Ktx/sec 3.1 Ktx/sec
stdb_raw 🧠 u32_u64_str unique_0 2048 256 240.0±0.37µs 251.4±0.41µs 4.1 Ktx/sec 3.9 Ktx/sec
stdb_raw 🧠 u32_u64_u64 btree_each_column 2048 256 242.7±0.08µs 252.8±0.19µs 4.0 Ktx/sec 3.9 Ktx/sec
stdb_raw 🧠 u32_u64_u64 unique_0 2048 256 218.1±0.19µs 229.4±0.21µs 4.5 Ktx/sec 4.3 Ktx/sec

iterate

db on disk schema indices new latency old latency new throughput old throughput
sqlite 💿 u32_u64_str unique_0 20.6±0.08µs 22.3±0.19µs 47.4 Ktx/sec 43.8 Ktx/sec
sqlite 💿 u32_u64_u64 unique_0 19.2±0.06µs 20.6±0.11µs 50.9 Ktx/sec 47.3 Ktx/sec
sqlite 🧠 u32_u64_str unique_0 17.8±0.06µs 19.7±0.08µs 54.8 Ktx/sec 49.5 Ktx/sec
sqlite 🧠 u32_u64_u64 unique_0 16.7±0.04µs 18.1±0.13µs 58.5 Ktx/sec 53.8 Ktx/sec
stdb_raw 💿 u32_u64_str unique_0 4.8±0.00µs 4.7±0.00µs 205.4 Ktx/sec 206.7 Ktx/sec
stdb_raw 💿 u32_u64_u64 unique_0 4.6±0.00µs 4.6±0.00µs 211.0 Ktx/sec 211.3 Ktx/sec
stdb_raw 🧠 u32_u64_str unique_0 4.8±0.00µs 4.7±0.00µs 205.2 Ktx/sec 206.1 Ktx/sec
stdb_raw 🧠 u32_u64_u64 unique_0 4.6±0.01µs 4.6±0.00µs 211.0 Ktx/sec 211.2 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.9±0.28µs 67.2±0.11µs 14.2 Ktx/sec 14.5 Ktx/sec
sqlite 💿 u64 index 2048 256 64.3±0.13µs 66.2±0.27µs 15.2 Ktx/sec 14.7 Ktx/sec
sqlite 🧠 string index 2048 256 64.5±0.17µs 64.8±0.19µs 15.1 Ktx/sec 15.1 Ktx/sec
sqlite 🧠 u64 index 2048 256 58.1±0.08µs 60.0±0.29µs 16.8 Ktx/sec 16.3 Ktx/sec
stdb_raw 💿 string index 2048 256 4.9±0.00µs 4.9±0.00µs 198.5 Ktx/sec 198.7 Ktx/sec
stdb_raw 💿 u64 index 2048 256 4.7±0.00µs 4.7±0.00µs 208.1 Ktx/sec 208.2 Ktx/sec
stdb_raw 🧠 string index 2048 256 4.9±0.00µs 4.9±0.00µs 198.3 Ktx/sec 198.9 Ktx/sec
stdb_raw 🧠 u64 index 2048 256 4.7±0.00µs 4.7±0.00µs 208.2 Ktx/sec 208.3 Ktx/sec

serialize

schema format count new latency old latency new throughput old throughput
u32_u64_str bflatn_to_bsatn_fast_path 100 3.4±0.03µs 3.3±0.02µs 28.4 Mtx/sec 28.5 Mtx/sec
u32_u64_str bflatn_to_bsatn_slow_path 100 3.0±0.03µs 3.0±0.04µs 31.3 Mtx/sec 31.6 Mtx/sec
u32_u64_str bsatn 100 2.3±0.00µs 2.3±0.00µs 41.2 Mtx/sec 41.1 Mtx/sec
u32_u64_str bsatn 100 40.5±0.09ns 39.9±0.15ns 2.3 Gtx/sec 2.3 Gtx/sec
u32_u64_str json 100 5.7±0.09µs 5.6±0.03µs 16.7 Mtx/sec 16.9 Mtx/sec
u32_u64_str json 100 8.4±0.03µs 8.4±0.04µs 11.4 Mtx/sec 11.4 Mtx/sec
u32_u64_str product_value 100 1015.9±0.83ns 1015.9±0.55ns 93.9 Mtx/sec 93.9 Mtx/sec
u32_u64_u64 bflatn_to_bsatn_fast_path 100 1137.2±1.79ns 1120.3±12.72ns 83.9 Mtx/sec 85.1 Mtx/sec
u32_u64_u64 bflatn_to_bsatn_slow_path 100 2.5±0.00µs 2.5±0.00µs 38.6 Mtx/sec 37.9 Mtx/sec
u32_u64_u64 bsatn 100 1782.1±46.36ns 1761.0±115.88ns 53.5 Mtx/sec 54.2 Mtx/sec
u32_u64_u64 bsatn 100 39.4±0.11ns 39.7±0.04ns 2.4 Gtx/sec 2.3 Gtx/sec
u32_u64_u64 json 100 3.3±0.03µs 3.4±0.03µs 29.1 Mtx/sec 27.9 Mtx/sec
u32_u64_u64 json 100 4.9±0.01µs 4.9±0.01µs 19.6 Mtx/sec 19.4 Mtx/sec
u32_u64_u64 product_value 100 1014.4±3.35ns 1015.5±1.37ns 94.0 Mtx/sec 93.9 Mtx/sec
u64_u64_u32 bflatn_to_bsatn_fast_path 100 899.8±2.48ns 896.7±5.67ns 106.0 Mtx/sec 106.4 Mtx/sec
u64_u64_u32 bflatn_to_bsatn_slow_path 100 2.5±0.00µs 2.5±0.07µs 38.6 Mtx/sec 37.8 Mtx/sec
u64_u64_u32 bsatn 100 1719.2±34.79ns 1739.6±33.46ns 55.5 Mtx/sec 54.8 Mtx/sec
u64_u64_u32 bsatn 100 755.0±0.46ns 756.0±1.42ns 126.3 Mtx/sec 126.2 Mtx/sec
u64_u64_u32 json 100 3.3±0.10µs 3.4±0.03µs 29.2 Mtx/sec 28.1 Mtx/sec
u64_u64_u32 json 100 5.0±0.01µs 5.0±0.00µs 19.1 Mtx/sec 19.1 Mtx/sec
u64_u64_u32 product_value 100 1014.2±0.76ns 1016.2±0.74ns 94.0 Mtx/sec 93.8 Mtx/sec

stdb_module_large_arguments

arg size new latency old latency new throughput old throughput
64KiB 112.3±6.44µs 111.5±12.83µs - -

stdb_module_print_bulk

line count new latency old latency new throughput old throughput
1 54.1±5.97µs 56.1±4.68µs - -
100 594.8±13.82µs 595.0±7.12µs - -
1000 5.2±0.62ms 3.5±0.27ms - -

remaining

name new latency old latency new throughput old throughput
special/db_game/circles/load=10 294.4±2.37µs 296.9±2.35µs - -
special/db_game/circles/load=100 291.5±6.68µs 293.0±3.86µ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 52.2±0.52µs 54.8±0.07µs 18.7 Ktx/sec 17.8 Ktx/sec
sqlite/💿/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 44.8±0.12µs 47.0±0.65µs 21.8 Ktx/sec 20.8 Ktx/sec
sqlite/🧠/update_bulk/u32_u64_str/unique_0/load=2048/count=256 38.0±0.04µs 39.7±0.45µs 25.7 Ktx/sec 24.6 Ktx/sec
sqlite/🧠/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 33.8±0.04µs 36.5±0.12µs 28.9 Ktx/sec 26.8 Ktx/sec
stdb_module/💿/update_bulk/u32_u64_str/unique_0/load=2048/count=256 1286.6±14.26µs 1292.2±13.58µs 777 tx/sec 773 tx/sec
stdb_module/💿/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 1019.7±9.16µs 1053.6±18.26µs 980 tx/sec 949 tx/sec
stdb_raw/💿/update_bulk/u32_u64_str/unique_0/load=2048/count=256 557.6±34.29µs 639.9±38.72µs 1793 tx/sec 1562 tx/sec
stdb_raw/💿/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 438.4±4.97µs 494.9±6.27µs 2.2 Ktx/sec 2020 tx/sec
stdb_raw/🧠/update_bulk/u32_u64_str/unique_0/load=2048/count=256 371.0±0.23µs 383.5±0.95µs 2.6 Ktx/sec 2.5 Ktx/sec
stdb_raw/🧠/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 334.2±0.38µs 348.2±0.23µs 2.9 Ktx/sec 2.8 Ktx/sec

Please sign in to comment.