Skip to content

Commit

Permalink
commitlog: Yield StoredCommit in iterators (#1791)
Browse files Browse the repository at this point in the history
  • Loading branch information
kim authored Oct 8, 2024
1 parent 9eb2491 commit afeb342
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 31 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

13 changes: 8 additions & 5 deletions crates/commitlog/src/commitlog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ impl<R: Repo> Commits<R> {
/// Helper to handle a successfully extracted commit in [`Self::next`].
///
/// Checks that the offset sequence is contiguous.
fn next_commit(&mut self, commit: StoredCommit) -> Option<Result<Commit, error::Traversal>> {
fn next_commit(&mut self, commit: StoredCommit) -> Option<Result<StoredCommit, error::Traversal>> {
// Pop the last error. Either we'll return it below, or it's no longer
// interesting.
let prev_error = self.last_error.take();
Expand Down Expand Up @@ -548,7 +548,7 @@ impl<R: Repo> Commits<R> {
checksum: commit.checksum,
};

Some(Ok(Commit::from(commit)))
Some(Ok(commit))
}
}

Expand All @@ -572,7 +572,7 @@ impl<R: Repo> Commits<R> {
}

impl<R: Repo> Iterator for Commits<R> {
type Item = Result<Commit, error::Traversal>;
type Item = Result<StoredCommit, error::Traversal>;

fn next(&mut self) -> Option<Self::Item> {
if let Some(commits) = self.inner.as_mut() {
Expand Down Expand Up @@ -642,7 +642,7 @@ impl<R: Repo> Iterator for CommitsWithVersion<R> {
.current_segment_header()
.map(|hdr| hdr.log_format_version)
.expect("segment header none even though segment yielded a commit");
Some(Ok((version, commit)))
Some(Ok((version, commit.into())))
}
Err(e) => Some(Err(e)),
}
Expand Down Expand Up @@ -792,7 +792,10 @@ mod tests {

assert_eq!(
[commit1, commit2].as_slice(),
&log.commits_from(0).collect::<Result<Vec<_>, _>>().unwrap()
&log.commits_from(0)
.map_ok(Commit::from)
.collect::<Result<Vec<_>, _>>()
.unwrap()
);
}

Expand Down
36 changes: 18 additions & 18 deletions crates/commitlog/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod varchar;
mod varint;

pub use crate::{
commit::Commit,
commit::{Commit, StoredCommit},
payload::{Decoder, Encode},
segment::{Transaction, DEFAULT_LOG_FORMAT_VERSION},
varchar::Varchar,
Expand Down Expand Up @@ -89,7 +89,7 @@ impl Default for Options {
/// The canonical commitlog, backed by on-disk log files.
///
/// Records in the log are of type `T`, which canonically is instantiated to
/// [`Txdata`].
/// [`payload::Txdata`].
pub struct Commitlog<T> {
inner: RwLock<commitlog::Generic<repo::Fs, T>>,
}
Expand Down Expand Up @@ -181,7 +181,7 @@ impl<T> Commitlog<T> {
}

/// Obtain an iterator which traverses the log from the start, yielding
/// [`Commit`]s.
/// [`StoredCommit`]s.
///
/// The returned iterator is not aware of segment rotation. That is, if a
/// new segment is created after this method returns, the iterator will not
Expand All @@ -192,27 +192,27 @@ impl<T> Commitlog<T> {
/// however, a new iterator should be created using [`Self::commits_from`]
/// with the last transaction offset yielded.
///
/// Note that the very last [`Commit`] in a commitlog may be corrupt (e.g.
/// due to a partial write to disk), but a subsequent `append` will bring
/// the log into a consistent state.
/// Note that the very last [`StoredCommit`] in a commitlog may be corrupt
/// (e.g. due to a partial write to disk), but a subsequent `append` will
/// bring the log into a consistent state.
///
/// This means that, when this iterator yields an `Err` value, the consumer
/// may want to check if the iterator is exhausted (by calling `next()`)
/// before treating the `Err` value as an application error.
pub fn commits(&self) -> impl Iterator<Item = Result<Commit, error::Traversal>> {
pub fn commits(&self) -> impl Iterator<Item = Result<StoredCommit, error::Traversal>> {
self.commits_from(0)
}

/// Obtain an iterator starting from transaction offset `offset`, yielding
/// [`Commit`]s.
/// [`StoredCommit`]s.
///
/// Similar to [`Self::commits`] but will skip until the offset is contained
/// in the next [`Commit`] to yield.
/// in the next [`StoredCommit`] to yield.
///
/// Note that the first [`Commit`] yielded is the first commit containing
/// the given transaction offset, i.e. its `min_tx_offset` may be smaller
/// than `offset`.
pub fn commits_from(&self, offset: u64) -> impl Iterator<Item = Result<Commit, error::Traversal>> {
/// Note that the first [`StoredCommit`] yielded is the first commit
/// containing the given transaction offset, i.e. its `min_tx_offset` may be
/// smaller than `offset`.
pub fn commits_from(&self, offset: u64) -> impl Iterator<Item = Result<StoredCommit, error::Traversal>> {
self.inner.read().unwrap().commits_from(offset)
}

Expand Down Expand Up @@ -372,7 +372,7 @@ impl<T: Encode> Commitlog<T> {
/// data (e.g. `Decoder<Record = ()>`), as it will not allocate the commit
/// payload into a struct.
///
/// Note that, unlike [`Self::transaction`], this method will ignore a
/// Note that, unlike [`Self::transactions`], this method will ignore a
/// corrupt commit at the very end of the traversed log.
pub fn fold_transactions<D>(&self, de: D) -> Result<(), D::Error>
where
Expand All @@ -398,23 +398,23 @@ impl<T: Encode> Commitlog<T> {
}

/// Obtain an iterator which traverses the commitlog located at the `root`
/// directory from the start, yielding [`Commit`]s.
/// directory from the start, yielding [`StoredCommit`]s.
///
/// Starts the traversal without the upfront I/O imposed by [`Commitlog::open`].
/// See [`Commitlog::commits`] for more information.
pub fn commits(root: impl Into<PathBuf>) -> io::Result<impl Iterator<Item = Result<Commit, error::Traversal>>> {
pub fn commits(root: impl Into<PathBuf>) -> io::Result<impl Iterator<Item = Result<StoredCommit, error::Traversal>>> {
commits_from(root, 0)
}

/// Obtain an iterator which traverses the commitlog located at the `root`
/// directory starting from `offset` and yielding [`Commit`]s.
/// directory starting from `offset` and yielding [`StoredCommit`]s.
///
/// Starts the traversal without the upfront I/O imposed by [`Commitlog::open`].
/// See [`Commitlog::commits_from`] for more information.
pub fn commits_from(
root: impl Into<PathBuf>,
offset: u64,
) -> io::Result<impl Iterator<Item = Result<Commit, error::Traversal>>> {
) -> io::Result<impl Iterator<Item = Result<StoredCommit, error::Traversal>>> {
commitlog::commits_from(repo::Fs::new(root), DEFAULT_LOG_FORMAT_VERSION, offset)
}

Expand Down
4 changes: 2 additions & 2 deletions crates/commitlog/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Encode for () {
///
/// Unlike [`Encode`], this is not a datatype: the canonical commitlog format
/// requires to look up row types during log traversal in order to be able to
/// decode (see also [`RowDecoder`]).
/// decode.
pub trait Decoder {
/// The type of records this decoder can decode.
/// This is also the type which can be appended to a commitlog, and so must
Expand All @@ -53,7 +53,7 @@ pub trait Decoder {
/// Decode one [`Self::Record`] from the given buffer.
///
/// The `version` argument corresponds to the log format version of the
/// current segment (see [`segment::Header::log_format_version`]).
/// current segment (see [`crate::segment::Header::log_format_version`]).
///
/// The `tx_argument` is the transaction offset of the current record
/// relative to the start of the log.
Expand Down
2 changes: 1 addition & 1 deletion crates/commitlog/src/payload/txdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
// Re-export so we get a hyperlink in rustdocs by default
pub use spacetimedb_primitives::TableId;

/// A visitor useful to implement stateful [`Decoder`]s of [`Txdata`] payloads.
/// A visitor useful to implement stateful [`super::Decoder`]s of [`Txdata`] payloads.
pub trait Visitor {
type Error: From<DecodeError>;
/// The type corresponding to one element in [`Ops::rowdata`].
Expand Down
8 changes: 4 additions & 4 deletions crates/commitlog/src/repo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub trait Repo: Clone {
/// `offset` does not exist.
///
/// The method does not guarantee that the segment is non-empty -- this case
/// will be caught by [`open_segment_writer`] and [`open_segment_reader`]
/// will be caught by [`resume_segment_writer`] and [`open_segment_reader`]
/// respectively.
fn open_segment(&self, offset: u64) -> io::Result<Self::Segment>;

Expand Down Expand Up @@ -178,9 +178,9 @@ pub fn resume_segment_writer<R: Repo>(

/// Open the existing segment at `offset` for reading.
///
/// Unlike [`open_segment_writer`], this does not traverse the segment. It does,
/// however, attempt to read the segment header and checks that the log format
/// version and checksum algorithm are compatible.
/// Unlike [`resume_segment_writer`], this does not traverse the segment. It
/// does, however, attempt to read the segment header and checks that the log
/// format version and checksum algorithm are compatible.
pub fn open_segment_reader<R: Repo>(
repo: &R,
max_log_format_version: u8,
Expand Down
1 change: 1 addition & 0 deletions crates/durability/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ description = "Traits and single-node implementation of durability for Spacetime

[dependencies]
anyhow.workspace = true
itertools.workspace = true
log.workspace = true
spacetimedb-commitlog.workspace = true
spacetimedb-sats.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion crates/durability/src/imp/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use std::{
};

use anyhow::Context as _;
use itertools::Itertools as _;
use log::{info, trace, warn};
use spacetimedb_commitlog::{error, payload::Txdata, Commit, Commitlog, Decoder, Encode, Transaction};
use tokio::{
Expand Down Expand Up @@ -140,7 +141,7 @@ impl<T: Encode + Send + Sync + 'static> Local<T> {

/// Obtain an iterator over the [`Commit`]s in the underlying log.
pub fn commits_from(&self, offset: TxOffset) -> impl Iterator<Item = Result<Commit, error::Traversal>> {
self.clog.commits_from(offset)
self.clog.commits_from(offset).map_ok(Commit::from)
}

/// Apply all outstanding transactions to the [`Commitlog`] and flush it
Expand Down

2 comments on commit afeb342

@github-actions
Copy link

@github-actions github-actions bot commented on afeb342 Oct 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 💿 432.5±2.14ns 419.9±1.68ns - -
sqlite 🧠 432.5±2.76ns 404.8±4.13ns - -
stdb_raw 💿 630.0±1.16ns 626.2±0.31ns - -
stdb_raw 🧠 630.4±1.12ns 626.4±1.06ns - -

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 587.2±0.63µs 593.2±0.56µs 1703 tx/sec 1685 tx/sec
sqlite 💿 u32_u64_str unique_0 2048 256 152.0±0.24µs 152.4±0.15µs 6.4 Ktx/sec 6.4 Ktx/sec
sqlite 💿 u32_u64_u64 btree_each_column 2048 256 470.7±0.37µs 472.8±0.62µs 2.1 Ktx/sec 2.1 Ktx/sec
sqlite 💿 u32_u64_u64 unique_0 2048 256 140.9±0.76µs 138.1±1.20µs 6.9 Ktx/sec 7.1 Ktx/sec
sqlite 🧠 u32_u64_str btree_each_column 2048 256 450.1±0.46µs 451.7±0.77µs 2.2 Ktx/sec 2.2 Ktx/sec
sqlite 🧠 u32_u64_str unique_0 2048 256 124.5±0.47µs 120.4±0.53µs 7.8 Ktx/sec 8.1 Ktx/sec
sqlite 🧠 u32_u64_u64 btree_each_column 2048 256 370.0±0.58µs 371.5±0.74µs 2.6 Ktx/sec 2.6 Ktx/sec
sqlite 🧠 u32_u64_u64 unique_0 2048 256 110.1±0.68µs 105.6±0.40µs 8.9 Ktx/sec 9.2 Ktx/sec
stdb_raw 💿 u32_u64_str btree_each_column 2048 256 586.4±21.25µs 588.8±18.45µs 1705 tx/sec 1698 tx/sec
stdb_raw 💿 u32_u64_str unique_0 2048 256 434.0±30.26µs 460.0±38.74µs 2.3 Ktx/sec 2.1 Ktx/sec
stdb_raw 💿 u32_u64_u64 btree_each_column 2048 256 372.0±17.41µs 385.9±5.45µs 2.6 Ktx/sec 2.5 Ktx/sec
stdb_raw 💿 u32_u64_u64 unique_0 2048 256 354.1±13.19µs 350.2±11.12µs 2.8 Ktx/sec 2.8 Ktx/sec
stdb_raw 🧠 u32_u64_str btree_each_column 2048 256 309.6±0.23µs 304.7±0.26µs 3.2 Ktx/sec 3.2 Ktx/sec
stdb_raw 🧠 u32_u64_str unique_0 2048 256 242.7±0.37µs 236.5±0.35µs 4.0 Ktx/sec 4.1 Ktx/sec
stdb_raw 🧠 u32_u64_u64 btree_each_column 2048 256 246.1±0.71µs 248.3±0.17µs 4.0 Ktx/sec 3.9 Ktx/sec
stdb_raw 🧠 u32_u64_u64 unique_0 2048 256 221.3±0.27µs 217.2±0.16µs 4.4 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 24.7±0.09µs 22.2±0.28µs 39.5 Ktx/sec 44.0 Ktx/sec
sqlite 💿 u32_u64_u64 unique_0 21.5±0.19µs 21.1±0.20µs 45.5 Ktx/sec 46.4 Ktx/sec
sqlite 🧠 u32_u64_str unique_0 22.0±0.05µs 19.7±0.29µs 44.4 Ktx/sec 49.6 Ktx/sec
sqlite 🧠 u32_u64_u64 unique_0 18.6±0.13µs 18.1±0.28µs 52.6 Ktx/sec 54.0 Ktx/sec
stdb_raw 💿 u32_u64_str unique_0 4.7±0.00µs 4.8±0.00µs 206.7 Ktx/sec 204.8 Ktx/sec
stdb_raw 💿 u32_u64_u64 unique_0 4.6±0.00µs 4.6±0.00µs 211.2 Ktx/sec 210.6 Ktx/sec
stdb_raw 🧠 u32_u64_str unique_0 4.7±0.00µs 4.8±0.00µs 206.7 Ktx/sec 204.9 Ktx/sec
stdb_raw 🧠 u32_u64_u64 unique_0 4.6±0.00µs 4.6±0.00µs 211.1 Ktx/sec 210.7 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 69.2±0.25µs 68.7±0.20µs 14.1 Ktx/sec 14.2 Ktx/sec
sqlite 💿 u64 index 2048 256 65.7±0.34µs 65.9±0.47µs 14.9 Ktx/sec 14.8 Ktx/sec
sqlite 🧠 string index 2048 256 66.3±0.30µs 65.3±0.12µs 14.7 Ktx/sec 15.0 Ktx/sec
sqlite 🧠 u64 index 2048 256 60.1±0.18µs 59.5±0.46µs 16.2 Ktx/sec 16.4 Ktx/sec
stdb_raw 💿 string index 2048 256 4.8±0.00µs 4.8±0.00µs 201.7 Ktx/sec 201.8 Ktx/sec
stdb_raw 💿 u64 index 2048 256 4.8±0.00µs 4.8±0.00µs 202.0 Ktx/sec 201.8 Ktx/sec
stdb_raw 🧠 string index 2048 256 4.8±0.00µs 4.8±0.00µs 201.8 Ktx/sec 202.0 Ktx/sec
stdb_raw 🧠 u64 index 2048 256 4.8±0.00µs 4.8±0.00µs 201.9 Ktx/sec 202.0 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.00µs 3.3±0.01µs 28.8 Mtx/sec 28.8 Mtx/sec
u32_u64_str bflatn_to_bsatn_slow_path 100 3.1±0.00µs 3.0±0.01µs 31.2 Mtx/sec 31.8 Mtx/sec
u32_u64_str bsatn 100 2.4±0.02µs 2.4±0.00µs 40.3 Mtx/sec 39.8 Mtx/sec
u32_u64_str bsatn 100 40.5±0.12ns 40.4±0.07ns 2.3 Gtx/sec 2.3 Gtx/sec
u32_u64_str json 100 4.9±0.06µs 5.0±0.06µs 19.3 Mtx/sec 19.0 Mtx/sec
u32_u64_str json 100 7.9±0.02µs 7.0±0.02µs 12.1 Mtx/sec 13.6 Mtx/sec
u32_u64_str product_value 100 1016.3±6.17ns 1020.4±20.34ns 93.8 Mtx/sec 93.5 Mtx/sec
u32_u64_u64 bflatn_to_bsatn_fast_path 100 1152.0±11.91ns 1100.7±9.59ns 82.8 Mtx/sec 86.6 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.3 Mtx/sec
u32_u64_u64 bsatn 100 1703.5±30.00ns 1682.8±33.72ns 56.0 Mtx/sec 56.7 Mtx/sec
u32_u64_u64 bsatn 100 39.2±0.09ns 29.1±0.03ns 2.4 Gtx/sec 3.2 Gtx/sec
u32_u64_u64 json 100 3.3±0.03µs 3.2±0.05µs 28.8 Mtx/sec 30.2 Mtx/sec
u32_u64_u64 json 100 6.1±0.01µs 4.9±0.03µs 15.8 Mtx/sec 19.5 Mtx/sec
u32_u64_u64 product_value 100 1013.5±1.33ns 1014.1±1.16ns 94.1 Mtx/sec 94.0 Mtx/sec
u64_u64_u32 bflatn_to_bsatn_fast_path 100 907.5±10.60ns 888.5±3.60ns 105.1 Mtx/sec 107.3 Mtx/sec
u64_u64_u32 bflatn_to_bsatn_slow_path 100 2.4±0.00µs 2.4±0.00µs 39.0 Mtx/sec 39.2 Mtx/sec
u64_u64_u32 bsatn 100 1723.8±33.34ns 1682.1±28.55ns 55.3 Mtx/sec 56.7 Mtx/sec
u64_u64_u32 bsatn 100 708.0±0.36ns 707.9±1.12ns 134.7 Mtx/sec 134.7 Mtx/sec
u64_u64_u32 json 100 3.3±0.04µs 3.4±0.16µs 28.6 Mtx/sec 28.1 Mtx/sec
u64_u64_u32 json 100 5.3±0.04µs 5.0±0.07µs 18.1 Mtx/sec 19.2 Mtx/sec
u64_u64_u32 product_value 100 1014.6±0.54ns 1015.9±0.63ns 94.0 Mtx/sec 93.9 Mtx/sec

stdb_module_large_arguments

arg size new latency old latency new throughput old throughput
64KiB 104.3±7.86µs 108.7±7.33µs - -

stdb_module_print_bulk

line count new latency old latency new throughput old throughput
1 56.0±6.51µs 52.6±7.62µs - -
100 606.2±6.17µs 601.2±8.65µs - -
1000 4.9±0.77ms 5.1±0.57ms - -

remaining

name new latency old latency new throughput old throughput
special/db_game/circles/load=10 297.8±2.60µs 296.2±2.79µs - -
special/db_game/circles/load=100 296.8±1.42µs 292.6±1.97µ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 57.0±0.20µs 54.5±0.16µs 17.1 Ktx/sec 17.9 Ktx/sec
sqlite/💿/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 48.0±0.30µs 46.7±0.25µs 20.3 Ktx/sec 20.9 Ktx/sec
sqlite/🧠/update_bulk/u32_u64_str/unique_0/load=2048/count=256 42.6±0.14µs 39.3±0.19µs 23.0 Ktx/sec 24.9 Ktx/sec
sqlite/🧠/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 37.5±0.21µs 35.3±0.33µs 26.0 Ktx/sec 27.7 Ktx/sec
stdb_module/💿/update_bulk/u32_u64_str/unique_0/load=2048/count=256 1295.1±13.38µs 1297.4±18.89µs 772 tx/sec 770 tx/sec
stdb_module/💿/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 1041.2±13.76µs 972.4±23.27µs 960 tx/sec 1028 tx/sec
stdb_raw/💿/update_bulk/u32_u64_str/unique_0/load=2048/count=256 548.0±8.61µs 546.6±14.22µs 1824 tx/sec 1829 tx/sec
stdb_raw/💿/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 491.6±7.85µs 435.3±11.55µs 2034 tx/sec 2.2 Ktx/sec
stdb_raw/🧠/update_bulk/u32_u64_str/unique_0/load=2048/count=256 371.9±0.90µs 366.7±0.64µs 2.6 Ktx/sec 2.7 Ktx/sec
stdb_raw/🧠/update_bulk/u32_u64_u64/unique_0/load=2048/count=256 338.0±0.57µs 333.7±0.23µs 2.9 Ktx/sec 2.9 Ktx/sec

@github-actions
Copy link

@github-actions github-actions bot commented on afeb342 Oct 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 5395 5395 0.00% 5445 5475 -0.55%
sqlite 5509 5509 0.00% 5975 5921 0.91%

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 117820 117799 0.02% 118306 118359 -0.04%
stdb_raw u32_u64_str no_index 64 128 1 u64 75388 75388 0.00% 75680 75826 -0.19%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24077 24061 0.07% 24539 24605 -0.27%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23029 23029 0.00% 23369 23431 -0.26%
sqlite u32_u64_str no_index 64 128 2 string 144677 144677 0.00% 146093 146199 -0.07%
sqlite u32_u64_str no_index 64 128 1 u64 124027 124027 0.00% 125153 125299 -0.12%
sqlite u32_u64_str btree_each_column 64 128 2 string 134476 134476 0.00% 136080 136090 -0.01%
sqlite u32_u64_str btree_each_column 64 128 1 u64 131344 131354 -0.01% 132610 132826 -0.16%

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 896009 895990 0.00% 945871 944036 0.19%
stdb_raw u32_u64_str btree_each_column 64 128 1048246 1046580 0.16% 1088480 1089000 -0.05%
sqlite u32_u64_str unique_0 64 128 398158 398158 0.00% 418024 416882 0.27%
sqlite u32_u64_str btree_each_column 64 128 983475 983485 -0.00% 1023275 1018745 0.44%

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% 152763 152765 -0.00%
stdb_raw u32_u64_str unique_0 64 15706 15706 0.00% 15780 15778 0.01%
sqlite u32_u64_str unique_0 1024 1046671 1046659 0.00% 1050099 1050077 0.00%
sqlite u32_u64_str unique_0 64 74799 74799 0.00% 75897 75829 0.09%

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% 49928 49992 -0.13%
64 bsatn 25716 25716 0.00% 27960 27960 0.00%
16 json 12126 12126 0.00% 13928 13996 -0.49%
16 bsatn 8117 8117 0.00% 9477 9477 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 20632920 20624505 0.04% 21255850 21298253 -0.20%
stdb_raw u32_u64_str unique_0 64 128 1301039 1302486 -0.11% 1377249 1350382 1.99%
sqlite u32_u64_str unique_0 1024 1024 1802091 1802091 0.00% 1811505 1811359 0.01%
sqlite u32_u64_str unique_0 64 128 128437 128437 0.00% 131321 131341 -0.02%
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% 5455 5485 -0.55%
sqlite 5551 5551 0.00% 6089 6019 1.16%

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 118898 -0.92% 118283 119490 -1.01%
stdb_raw u32_u64_str no_index 64 128 1 u64 75398 75398 0.00% 75622 75784 -0.21%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24071 24071 0.00% 24525 24607 -0.33%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23039 23039 0.00% 23335 23429 -0.40%
sqlite u32_u64_str no_index 64 128 2 string 146598 146598 0.00% 148318 148468 -0.10%
sqlite u32_u64_str no_index 64 128 1 u64 125948 125948 0.00% 127422 127556 -0.11%
sqlite u32_u64_str btree_each_column 64 128 2 string 136598 136598 0.00% 138652 138650 0.00%
sqlite u32_u64_str btree_each_column 64 128 1 u64 133440 133440 0.00% 135192 135342 -0.11%

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 845992 845629 0.04% 894924 892429 0.28%
stdb_raw u32_u64_str btree_each_column 64 128 997925 996517 0.14% 1068493 1068691 -0.02%
sqlite u32_u64_str unique_0 64 128 415695 415695 0.00% 435019 433675 0.31%
sqlite u32_u64_str btree_each_column 64 128 1021736 1021736 0.00% 1060706 1055690 0.48%

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% 152765 152763 0.00%
stdb_raw u32_u64_str unique_0 64 15716 15716 0.00% 15786 15788 -0.01%
sqlite u32_u64_str unique_0 1024 1049721 1049721 0.00% 1053575 1053515 0.01%
sqlite u32_u64_str unique_0 64 76571 76571 0.00% 77865 77921 -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% 49928 49992 -0.13%
64 bsatn 25716 25716 0.00% 27960 27960 0.00%
16 json 12126 12126 0.00% 13928 13996 -0.49%
16 bsatn 8117 8117 0.00% 9477 9477 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 19330384 19326488 0.02% 20060108 20101690 -0.21%
stdb_raw u32_u64_str unique_0 64 128 1254209 1254308 -0.01% 1328517 1332632 -0.31%
sqlite u32_u64_str unique_0 1024 1024 1809652 1809652 0.00% 1818266 1818468 -0.01%
sqlite u32_u64_str unique_0 64 128 132563 132563 0.00% 135575 135539 0.03%

Please sign in to comment.