Skip to content

Commit

Permalink
Add the slim_slice data-structures (#528)
Browse files Browse the repository at this point in the history
* add the slim_slice data-structures

* slim_slice: addres some review comments

* slim_slice: add basic SlimSmallSliceBox type + comment on SlimNonEmptyBox

* slim_slice: prefix conversions with 'from_'

* slim_slice: use transmute_copy

* add empty LICENSE file

* pacify clippy
  • Loading branch information
Centril authored Nov 16, 2023
1 parent 5a23fad commit 22fd5d7
Show file tree
Hide file tree
Showing 6 changed files with 1,960 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions crates/data-structures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ edition = "2021"
license-file = "LICENSE"
description = "Assorted data structures used in spacetimedb"

[features]
serde = ["dep:serde"]

[dependencies]
nonempty.workspace = true
serde = { workspace = true, optional = true }
thiserror.workspace = true
1 change: 1 addition & 0 deletions crates/data-structures/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions crates/data-structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
//! These structures are general and could be used outside spacetimedb.
pub mod nstr;
pub mod slim_slice;
10 changes: 10 additions & 0 deletions crates/data-structures/src/nstr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//! An example would be `nstr!("spacetime"): NStr<9>`.
use core::{fmt, ops::Deref, str};
use std::ops::DerefMut;

/// A UTF-8 string of known length `N`.
///
Expand Down Expand Up @@ -68,6 +69,15 @@ impl<const N: usize> Deref for NStr<N> {
}
}

impl<const N: usize> DerefMut for NStr<N> {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
// SAFETY: An `NStr<N>` can only be made through `__nstr(..)`
// and which receives an `&str` which is valid UTF-8.
unsafe { str::from_utf8_unchecked_mut(&mut self.0) }
}
}

impl<const N: usize> fmt::Debug for NStr<N> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.deref())
Expand Down
Loading

1 comment on commit 22fd5d7

@github-actions
Copy link

@github-actions github-actions bot commented on 22fd5d7 Nov 16, 2023

Choose a reason for hiding this comment

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

Benchmark results

Benchmark Report

Legend:

  • load: number of rows pre-loaded into the database
  • count: number of rows touched by the transaction
  • index types:
    • unique: a single index on the id column
    • non_unique: no indexes
    • multi_index: non-unique index on every column
  • schemas:
    • person(id: u32, name: String, age: u64)
    • location(id: u32, x: u64, y: u64)

All throughputs are single-threaded.

Empty transaction

db on disk new latency old latency new throughput old throughput
sqlite 💿 433.5±1.72ns 433.8±2.07ns - -
sqlite 🧠 428.4±1.50ns 424.9±1.53ns - -
stdb_module 💿 18.2±1.19µs 18.8±1.63µs - -
stdb_module 🧠 17.7±0.84µs 17.9±0.86µs - -
stdb_raw 💿 719.1±1.29ns 729.1±0.78ns - -
stdb_raw 🧠 713.8±0.95ns 725.1±1.83ns - -

Single-row insertions

db on disk schema index type load new latency old latency new throughput old throughput
sqlite 💿 location multi_index 0 14.8±0.24µs 15.0±1.70µs 66.0 Ktx/sec 65.3 Ktx/sec
sqlite 💿 location multi_index 1000 16.0±0.13µs 15.9±0.12µs 61.1 Ktx/sec 61.5 Ktx/sec
sqlite 💿 location non_unique 0 7.3±0.62µs 7.2±0.05µs 133.3 Ktx/sec 135.1 Ktx/sec
sqlite 💿 location non_unique 1000 7.1±0.08µs 7.3±1.41µs 138.2 Ktx/sec 134.1 Ktx/sec
sqlite 💿 location unique 0 7.3±0.04µs 7.3±0.05µs 134.3 Ktx/sec 134.4 Ktx/sec
sqlite 💿 location unique 1000 7.1±0.05µs 7.1±0.05µs 138.5 Ktx/sec 137.2 Ktx/sec
sqlite 💿 person multi_index 0 14.8±0.55µs 14.7±1.17µs 66.1 Ktx/sec 66.2 Ktx/sec
sqlite 💿 person multi_index 1000 16.1±0.12µs 16.1±0.07µs 60.7 Ktx/sec 60.6 Ktx/sec
sqlite 💿 person non_unique 0 7.4±0.37µs 7.4±0.43µs 132.4 Ktx/sec 131.4 Ktx/sec
sqlite 💿 person non_unique 1000 7.3±0.04µs 7.3±0.06µs 133.9 Ktx/sec 134.3 Ktx/sec
sqlite 💿 person unique 0 7.4±0.29µs 7.4±0.51µs 132.2 Ktx/sec 131.8 Ktx/sec
sqlite 💿 person unique 1000 7.3±0.05µs 7.3±0.03µs 134.2 Ktx/sec 133.9 Ktx/sec
sqlite 🧠 location multi_index 0 4.1±0.01µs 4.1±0.01µs 238.9 Ktx/sec 235.7 Ktx/sec
sqlite 🧠 location multi_index 1000 5.3±0.04µs 5.4±0.05µs 185.5 Ktx/sec 182.2 Ktx/sec
sqlite 🧠 location non_unique 0 1845.2±16.24ns 1877.4±6.25ns 529.3 Ktx/sec 520.2 Ktx/sec
sqlite 🧠 location non_unique 1000 1895.9±10.83ns 1956.5±18.05ns 515.1 Ktx/sec 499.1 Ktx/sec
sqlite 🧠 location unique 0 1837.3±5.48ns 1856.5±6.19ns 531.5 Ktx/sec 526.0 Ktx/sec
sqlite 🧠 location unique 1000 1953.3±10.50ns 1963.1±12.44ns 500.0 Ktx/sec 497.4 Ktx/sec
sqlite 🧠 person multi_index 0 3.7±0.01µs 3.7±0.01µs 265.2 Ktx/sec 263.0 Ktx/sec
sqlite 🧠 person multi_index 1000 5.5±0.05µs 5.5±0.04µs 177.6 Ktx/sec 177.6 Ktx/sec
sqlite 🧠 person non_unique 0 1927.5±7.34ns 1941.2±5.13ns 506.6 Ktx/sec 503.1 Ktx/sec
sqlite 🧠 person non_unique 1000 2.0±0.01µs 2.0±0.01µs 485.4 Ktx/sec 484.0 Ktx/sec
sqlite 🧠 person unique 0 1925.4±4.76ns 1944.6±4.23ns 507.2 Ktx/sec 502.2 Ktx/sec
sqlite 🧠 person unique 1000 2.0±0.01µs 2.0±0.01µs 484.2 Ktx/sec 479.5 Ktx/sec
stdb_module 💿 location multi_index 0 55.0±5.85µs 55.5±4.71µs 17.7 Ktx/sec 17.6 Ktx/sec
stdb_module 💿 location multi_index 1000 75.9±32.53µs 292.7±74.15µs 12.9 Ktx/sec 3.3 Ktx/sec
stdb_module 💿 location non_unique 0 45.9±3.90µs 47.9±5.28µs 21.3 Ktx/sec 20.4 Ktx/sec
stdb_module 💿 location non_unique 1000 111.8±37.47µs 76.7±18.01µs 8.7 Ktx/sec 12.7 Ktx/sec
stdb_module 💿 location unique 0 52.3±5.07µs 51.2±4.91µs 18.7 Ktx/sec 19.1 Ktx/sec
stdb_module 💿 location unique 1000 147.8±5.42µs 100.1±38.66µs 6.6 Ktx/sec 9.8 Ktx/sec
stdb_module 💿 person multi_index 0 65.2±4.42µs 64.2±6.64µs 15.0 Ktx/sec 15.2 Ktx/sec
stdb_module 💿 person multi_index 1000 206.8±6.91µs 300.5±10.91µs 4.7 Ktx/sec 3.2 Ktx/sec
stdb_module 💿 person non_unique 0 50.7±4.66µs 47.3±5.76µs 19.3 Ktx/sec 20.7 Ktx/sec
stdb_module 💿 person non_unique 1000 159.9±3.23µs 295.6±32.90µs 6.1 Ktx/sec 3.3 Ktx/sec
stdb_module 💿 person unique 0 56.8±4.50µs 54.5±6.43µs 17.2 Ktx/sec 17.9 Ktx/sec
stdb_module 💿 person unique 1000 76.8±35.95µs 117.7±13.96µs 12.7 Ktx/sec 8.3 Ktx/sec
stdb_module 🧠 location multi_index 0 37.4±3.02µs 37.4±3.02µs 26.1 Ktx/sec 26.1 Ktx/sec
stdb_module 🧠 location multi_index 1000 170.9±39.80µs 138.2±13.17µs 5.7 Ktx/sec 7.1 Ktx/sec
stdb_module 🧠 location non_unique 0 30.5±3.16µs 29.0±2.70µs 32.0 Ktx/sec 33.6 Ktx/sec
stdb_module 🧠 location non_unique 1000 118.2±6.40µs 264.3±8.20µs 8.3 Ktx/sec 3.7 Ktx/sec
stdb_module 🧠 location unique 0 35.8±3.12µs 33.5±3.57µs 27.3 Ktx/sec 29.1 Ktx/sec
stdb_module 🧠 location unique 1000 166.8±8.51µs 134.3±2.05µs 5.9 Ktx/sec 7.3 Ktx/sec
stdb_module 🧠 person multi_index 0 45.9±4.16µs 47.2±4.03µs 21.3 Ktx/sec 20.7 Ktx/sec
stdb_module 🧠 person multi_index 1000 143.4±105.28µs 281.4±7.47µs 6.8 Ktx/sec 3.5 Ktx/sec
stdb_module 🧠 person non_unique 0 32.0±2.88µs 32.3±3.53µs 30.6 Ktx/sec 30.2 Ktx/sec
stdb_module 🧠 person non_unique 1000 107.5±3.60µs 118.9±14.68µs 9.1 Ktx/sec 8.2 Ktx/sec
stdb_module 🧠 person unique 0 39.3±3.74µs 40.4±3.48µs 24.8 Ktx/sec 24.2 Ktx/sec
stdb_module 🧠 person unique 1000 104.7±7.93µs 150.2±11.97µs 9.3 Ktx/sec 6.5 Ktx/sec
stdb_raw 💿 location multi_index 0 7.1±0.01µs 7.2±0.02µs 137.4 Ktx/sec 135.3 Ktx/sec
stdb_raw 💿 location multi_index 1000 9.8±0.18µs 10.1±0.63µs 99.2 Ktx/sec 96.9 Ktx/sec
stdb_raw 💿 location non_unique 0 4.8±0.02µs 4.8±0.01µs 204.8 Ktx/sec 203.8 Ktx/sec
stdb_raw 💿 location non_unique 1000 6.3±0.17µs 6.2±0.15µs 156.0 Ktx/sec 156.9 Ktx/sec
stdb_raw 💿 location unique 0 6.0±0.39µs 6.1±0.01µs 161.5 Ktx/sec 159.1 Ktx/sec
stdb_raw 💿 location unique 1000 29.4±210.82µs 8.6±0.24µs 33.2 Ktx/sec 113.2 Ktx/sec
stdb_raw 💿 person multi_index 0 10.8±0.44µs 11.0±0.05µs 90.2 Ktx/sec 88.6 Ktx/sec
stdb_raw 💿 person multi_index 1000 56.2±419.97µs 55.7±412.40µs 17.4 Ktx/sec 17.5 Ktx/sec
stdb_raw 💿 person non_unique 0 5.4±0.01µs 5.4±0.13µs 182.1 Ktx/sec 182.5 Ktx/sec
stdb_raw 💿 person non_unique 1000 7.3±0.10µs 7.1±0.11µs 134.1 Ktx/sec 138.3 Ktx/sec
stdb_raw 💿 person unique 0 7.7±0.02µs 7.8±0.02µs 127.3 Ktx/sec 124.7 Ktx/sec
stdb_raw 💿 person unique 1000 10.3±0.13µs 38.4±278.41µs 94.4 Ktx/sec 25.4 Ktx/sec
stdb_raw 🧠 location multi_index 0 4.2±0.02µs 4.2±0.01µs 234.3 Ktx/sec 234.6 Ktx/sec
stdb_raw 🧠 location multi_index 1000 5.7±0.04µs 5.8±0.04µs 170.8 Ktx/sec 167.5 Ktx/sec
stdb_raw 🧠 location non_unique 0 1932.3±5.49ns 1941.9±5.04ns 505.4 Ktx/sec 502.9 Ktx/sec
stdb_raw 🧠 location non_unique 1000 2.4±0.02µs 2.5±0.01µs 405.4 Ktx/sec 394.4 Ktx/sec
stdb_raw 🧠 location unique 0 3.1±0.00µs 3.1±0.00µs 314.9 Ktx/sec 311.0 Ktx/sec
stdb_raw 🧠 location unique 1000 4.3±0.03µs 4.4±0.03µs 228.0 Ktx/sec 222.6 Ktx/sec
stdb_raw 🧠 person multi_index 0 7.8±0.02µs 7.9±0.08µs 125.1 Ktx/sec 123.9 Ktx/sec
stdb_raw 🧠 person multi_index 1000 10.0±0.07µs 10.1±0.09µs 97.8 Ktx/sec 96.7 Ktx/sec
stdb_raw 🧠 person non_unique 0 2.5±0.01µs 2.4±0.01µs 394.5 Ktx/sec 398.7 Ktx/sec
stdb_raw 🧠 person non_unique 1000 3.4±0.02µs 3.2±0.01µs 291.4 Ktx/sec 302.6 Ktx/sec
stdb_raw 🧠 person unique 0 4.7±0.01µs 4.8±0.01µs 207.0 Ktx/sec 205.5 Ktx/sec
stdb_raw 🧠 person unique 1000 6.1±0.02µs 6.2±0.06µs 159.4 Ktx/sec 157.6 Ktx/sec

Multi-row insertions

db on disk schema index type load count new latency old latency new throughput old throughput
sqlite 💿 location multi_index 0 100 131.3±3.48µs 133.0±0.42µs 7.4 Ktx/sec 7.3 Ktx/sec
sqlite 💿 location multi_index 1000 100 202.6±1.80µs 208.8±34.29µs 4.8 Ktx/sec 4.7 Ktx/sec
sqlite 💿 location non_unique 0 100 49.6±1.28µs 50.9±1.52µs 19.7 Ktx/sec 19.2 Ktx/sec
sqlite 💿 location non_unique 1000 100 52.5±0.39µs 53.4±0.23µs 18.6 Ktx/sec 18.3 Ktx/sec
sqlite 💿 location unique 0 100 52.7±6.93µs 53.0±1.43µs 18.5 Ktx/sec 18.4 Ktx/sec
sqlite 💿 location unique 1000 100 55.8±0.27µs 57.0±0.36µs 17.5 Ktx/sec 17.1 Ktx/sec
sqlite 💿 person multi_index 0 100 117.3±5.63µs 119.4±3.34µs 8.3 Ktx/sec 8.2 Ktx/sec
sqlite 💿 person multi_index 1000 100 229.1±0.47µs 230.3±0.35µs 4.3 Ktx/sec 4.2 Ktx/sec
sqlite 💿 person non_unique 0 100 47.7±1.69µs 49.0±1.24µs 20.5 Ktx/sec 19.9 Ktx/sec
sqlite 💿 person non_unique 1000 100 59.4±0.26µs 61.0±0.22µs 16.4 Ktx/sec 16.0 Ktx/sec
sqlite 💿 person unique 0 100 49.9±1.74µs 50.4±6.28µs 19.6 Ktx/sec 19.4 Ktx/sec
sqlite 💿 person unique 1000 100 54.5±0.25µs 56.1±11.65µs 17.9 Ktx/sec 17.4 Ktx/sec
sqlite 🧠 location multi_index 0 100 119.0±0.48µs 120.1±0.53µs 8.2 Ktx/sec 8.1 Ktx/sec
sqlite 🧠 location multi_index 1000 100 169.5±0.38µs 172.8±0.30µs 5.8 Ktx/sec 5.7 Ktx/sec
sqlite 🧠 location non_unique 0 100 43.6±0.29µs 44.1±0.36µs 22.4 Ktx/sec 22.1 Ktx/sec
sqlite 🧠 location non_unique 1000 100 43.8±0.40µs 45.1±0.27µs 22.3 Ktx/sec 21.7 Ktx/sec
sqlite 🧠 location unique 0 100 46.0±0.43µs 45.6±0.29µs 21.2 Ktx/sec 21.4 Ktx/sec
sqlite 🧠 location unique 1000 100 48.4±0.38µs 50.6±0.35µs 20.2 Ktx/sec 19.3 Ktx/sec
sqlite 🧠 person multi_index 0 100 104.1±0.38µs 106.9±0.26µs 9.4 Ktx/sec 9.1 Ktx/sec
sqlite 🧠 person multi_index 1000 100 190.1±0.28µs 191.7±0.21µs 5.1 Ktx/sec 5.1 Ktx/sec
sqlite 🧠 person non_unique 0 100 40.9±0.41µs 42.1±0.19µs 23.9 Ktx/sec 23.2 Ktx/sec
sqlite 🧠 person non_unique 1000 100 44.6±0.20µs 46.2±0.39µs 21.9 Ktx/sec 21.1 Ktx/sec
sqlite 🧠 person unique 0 100 44.2±0.39µs 43.6±0.71µs 22.1 Ktx/sec 22.4 Ktx/sec
sqlite 🧠 person unique 1000 100 47.7±0.30µs 47.8±0.36µs 20.5 Ktx/sec 20.4 Ktx/sec
stdb_module 💿 location multi_index 0 100 1026.9±72.96µs 1018.2±36.75µs 973 tx/sec 982 tx/sec
stdb_module 💿 location multi_index 1000 100 1158.1±95.66µs 773.8±146.17µs 863 tx/sec 1292 tx/sec
stdb_module 💿 location non_unique 0 100 642.8±168.38µs 629.6±20.84µs 1555 tx/sec 1588 tx/sec
stdb_module 💿 location non_unique 1000 100 764.1±94.16µs 777.1±82.44µs 1308 tx/sec 1286 tx/sec
stdb_module 💿 location unique 0 100 660.2±103.03µs 752.2±103.58µs 1514 tx/sec 1329 tx/sec
stdb_module 💿 location unique 1000 100 966.0±91.03µs 862.6±75.48µs 1035 tx/sec 1159 tx/sec
stdb_module 💿 person multi_index 0 100 1120.4±318.23µs 1175.0±167.53µs 892 tx/sec 851 tx/sec
stdb_module 💿 person multi_index 1000 100 1138.6±51.01µs 1245.4±75.45µs 878 tx/sec 802 tx/sec
stdb_module 💿 person non_unique 0 100 770.0±10.32µs 638.7±123.54µs 1298 tx/sec 1565 tx/sec
stdb_module 💿 person non_unique 1000 100 582.4±3.75µs 754.9±19.58µs 1717 tx/sec 1324 tx/sec
stdb_module 💿 person unique 0 100 748.7±2.14µs 794.7±1.56µs 1335 tx/sec 1258 tx/sec
stdb_module 💿 person unique 1000 100 823.0±10.14µs 1042.0±7.35µs 1215 tx/sec 959 tx/sec
stdb_module 🧠 location multi_index 0 100 511.4±40.89µs 593.2±4.43µs 1955 tx/sec 1685 tx/sec
stdb_module 🧠 location multi_index 1000 100 640.2±4.64µs 629.6±2.85µs 1562 tx/sec 1588 tx/sec
stdb_module 🧠 location non_unique 0 100 293.3±70.92µs 315.4±45.68µs 3.3 Ktx/sec 3.1 Ktx/sec
stdb_module 🧠 location non_unique 1000 100 363.1±23.66µs 459.5±89.36µs 2.7 Ktx/sec 2.1 Ktx/sec
stdb_module 🧠 location unique 0 100 479.6±71.37µs 613.7±7.63µs 2.0 Ktx/sec 1629 tx/sec
stdb_module 🧠 location unique 1000 100 571.6±9.18µs 539.2±97.41µs 1749 tx/sec 1854 tx/sec
stdb_module 🧠 person multi_index 0 100 892.2±44.70µs 871.6±46.95µs 1120 tx/sec 1147 tx/sec
stdb_module 🧠 person multi_index 1000 100 1140.4±6.48µs 914.8±25.26µs 876 tx/sec 1093 tx/sec
stdb_module 🧠 person non_unique 0 100 466.6±63.71µs 524.6±21.88µs 2.1 Ktx/sec 1906 tx/sec
stdb_module 🧠 person non_unique 1000 100 517.9±99.01µs 581.7±11.50µs 1930 tx/sec 1719 tx/sec
stdb_module 🧠 person unique 0 100 605.9±26.82µs 589.7±12.18µs 1650 tx/sec 1695 tx/sec
stdb_module 🧠 person unique 1000 100 700.7±53.96µs 827.3±25.34µs 1427 tx/sec 1208 tx/sec
stdb_raw 💿 location multi_index 0 100 402.1±2.92µs 401.8±1.30µs 2.4 Ktx/sec 2.4 Ktx/sec
stdb_raw 💿 location multi_index 1000 100 427.8±1.29µs 460.2±311.38µs 2.3 Ktx/sec 2.1 Ktx/sec
stdb_raw 💿 location non_unique 0 100 174.6±7.06µs 172.7±0.50µs 5.6 Ktx/sec 5.7 Ktx/sec
stdb_raw 💿 location non_unique 1000 100 187.3±105.88µs 175.1±0.92µs 5.2 Ktx/sec 5.6 Ktx/sec
stdb_raw 💿 location unique 0 100 297.7±0.45µs 297.9±0.47µs 3.3 Ktx/sec 3.3 Ktx/sec
stdb_raw 💿 location unique 1000 100 333.8±172.88µs 316.7±1.39µs 2.9 Ktx/sec 3.1 Ktx/sec
stdb_raw 💿 person multi_index 0 100 722.6±16.44µs 728.2±2.94µs 1383 tx/sec 1373 tx/sec
stdb_raw 💿 person multi_index 1000 100 750.2±1.04µs 770.4±141.68µs 1332 tx/sec 1298 tx/sec
stdb_raw 💿 person non_unique 0 100 230.5±0.41µs 229.7±0.19µs 4.2 Ktx/sec 4.3 Ktx/sec
stdb_raw 💿 person non_unique 1000 100 291.6±586.34µs 249.5±176.16µs 3.3 Ktx/sec 3.9 Ktx/sec
stdb_raw 💿 person unique 0 100 441.3±13.22µs 440.9±0.32µs 2.2 Ktx/sec 2.2 Ktx/sec
stdb_raw 💿 person unique 1000 100 456.4±0.65µs 489.4±300.04µs 2.1 Ktx/sec 2043 tx/sec
stdb_raw 🧠 location multi_index 0 100 302.9±0.77µs 298.8±0.81µs 3.2 Ktx/sec 3.3 Ktx/sec
stdb_raw 🧠 location multi_index 1000 100 327.8±0.35µs 325.2±0.55µs 3.0 Ktx/sec 3.0 Ktx/sec
stdb_raw 🧠 location non_unique 0 100 75.2±0.80µs 76.0±0.14µs 13.0 Ktx/sec 12.9 Ktx/sec
stdb_raw 🧠 location non_unique 1000 100 76.2±0.18µs 77.1±0.34µs 12.8 Ktx/sec 12.7 Ktx/sec
stdb_raw 🧠 location unique 0 100 198.8±0.27µs 200.3±0.31µs 4.9 Ktx/sec 4.9 Ktx/sec
stdb_raw 🧠 location unique 1000 100 216.7±0.37µs 218.3±0.73µs 4.5 Ktx/sec 4.5 Ktx/sec
stdb_raw 🧠 person multi_index 0 100 614.9±3.56µs 626.2±1.54µs 1626 tx/sec 1597 tx/sec
stdb_raw 🧠 person multi_index 1000 100 646.0±0.76µs 653.9±1.33µs 1547 tx/sec 1529 tx/sec
stdb_raw 🧠 person non_unique 0 100 126.6±0.14µs 127.8±0.11µs 7.7 Ktx/sec 7.6 Ktx/sec
stdb_raw 🧠 person non_unique 1000 100 128.4±0.22µs 129.9±0.19µs 7.6 Ktx/sec 7.5 Ktx/sec
stdb_raw 🧠 person unique 0 100 334.9±3.01µs 338.9±0.34µs 2.9 Ktx/sec 2.9 Ktx/sec
stdb_raw 🧠 person unique 1000 100 352.5±0.32µs 356.4±0.46µs 2.8 Ktx/sec 2.7 Ktx/sec

Full table iterate

db on disk schema index type new latency old latency new throughput old throughput
sqlite 💿 location unique 9.0±0.10µs 8.9±0.04µs 108.2 Ktx/sec 109.8 Ktx/sec
sqlite 💿 person unique 9.3±0.09µs 9.4±0.07µs 105.2 Ktx/sec 104.2 Ktx/sec
sqlite 🧠 location unique 7.9±0.10µs 7.7±0.04µs 123.8 Ktx/sec 127.2 Ktx/sec
sqlite 🧠 person unique 8.1±0.11µs 8.1±0.08µs 121.1 Ktx/sec 121.1 Ktx/sec
stdb_module 💿 location unique 50.5±6.60µs 51.8±3.66µs 19.3 Ktx/sec 18.8 Ktx/sec
stdb_module 💿 person unique 65.1±9.12µs 61.2±11.16µs 15.0 Ktx/sec 16.0 Ktx/sec
stdb_module 🧠 location unique 53.5±3.56µs 46.9±8.09µs 18.3 Ktx/sec 20.8 Ktx/sec
stdb_module 🧠 person unique 61.7±10.67µs 67.1±7.32µs 15.8 Ktx/sec 14.5 Ktx/sec
stdb_raw 💿 location unique 10.4±0.02µs 10.5±0.02µs 94.0 Ktx/sec 92.9 Ktx/sec
stdb_raw 💿 person unique 10.4±0.01µs 10.5±0.05µs 94.0 Ktx/sec 92.9 Ktx/sec
stdb_raw 🧠 location unique 10.4±0.02µs 10.5±0.13µs 94.0 Ktx/sec 92.8 Ktx/sec
stdb_raw 🧠 person unique 10.4±0.01µs 10.5±0.08µs 94.0 Ktx/sec 92.9 Ktx/sec

Find unique key

db on disk key type load new latency old latency new throughput old throughput
sqlite 💿 u32 1000 2.4±0.00µs 2.4±0.01µs 415.4 Ktx/sec 410.4 Ktx/sec
sqlite 🧠 u32 1000 1126.2±6.06ns 1156.3±5.38ns 867.1 Ktx/sec 844.6 Ktx/sec
stdb_module 💿 u32 1000 25.6±2.12µs 25.0±1.63µs 38.2 Ktx/sec 39.0 Ktx/sec
stdb_module 🧠 u32 1000 25.0±2.28µs 24.4±1.79µs 39.0 Ktx/sec 40.1 Ktx/sec
stdb_raw 💿 u32 1000 1908.6±2.77ns 1970.2±4.38ns 511.7 Ktx/sec 495.7 Ktx/sec
stdb_raw 🧠 u32 1000 1901.9±4.11ns 1948.4±5.63ns 513.5 Ktx/sec 501.2 Ktx/sec

Filter

db on disk key type index strategy load count new latency old latency new throughput old throughput
sqlite 💿 string indexed 1000 10 5.6±0.02µs 5.6±0.01µs 174.0 Ktx/sec 174.1 Ktx/sec
sqlite 💿 string non_indexed 1000 10 49.3±0.81µs 49.0±0.50µs 19.8 Ktx/sec 19.9 Ktx/sec
sqlite 💿 u64 indexed 1000 10 5.3±0.01µs 5.4±0.02µs 183.0 Ktx/sec 179.3 Ktx/sec
sqlite 💿 u64 non_indexed 1000 10 33.0±0.20µs 32.9±0.11µs 29.6 Ktx/sec 29.7 Ktx/sec
sqlite 🧠 string indexed 1000 10 4.1±0.01µs 4.2±0.01µs 235.6 Ktx/sec 233.3 Ktx/sec
sqlite 🧠 string non_indexed 1000 10 47.9±0.82µs 47.3±0.44µs 20.4 Ktx/sec 20.6 Ktx/sec
sqlite 🧠 u64 indexed 1000 10 4.0±0.02µs 4.1±0.02µs 245.8 Ktx/sec 240.3 Ktx/sec
sqlite 🧠 u64 non_indexed 1000 10 31.7±0.07µs 33.3±0.21µs 30.8 Ktx/sec 29.4 Ktx/sec
stdb_module 💿 string indexed 1000 10 36.0±2.52µs 36.8±2.92µs 27.1 Ktx/sec 26.6 Ktx/sec
stdb_module 💿 string non_indexed 1000 10 183.6±4.01µs 183.7±3.04µs 5.3 Ktx/sec 5.3 Ktx/sec
stdb_module 💿 u64 indexed 1000 10 33.6±2.16µs 33.4±2.17µs 29.1 Ktx/sec 29.3 Ktx/sec
stdb_module 💿 u64 non_indexed 1000 10 156.4±2.62µs 157.2±3.56µs 6.2 Ktx/sec 6.2 Ktx/sec
stdb_module 🧠 string indexed 1000 10 37.2±2.87µs 36.4±3.17µs 26.3 Ktx/sec 26.8 Ktx/sec
stdb_module 🧠 string non_indexed 1000 10 182.9±16.10µs 184.3±7.36µs 5.3 Ktx/sec 5.3 Ktx/sec
stdb_module 🧠 u64 indexed 1000 10 32.8±2.49µs 32.6±2.69µs 29.8 Ktx/sec 30.0 Ktx/sec
stdb_module 🧠 u64 non_indexed 1000 10 150.9±0.70µs 156.9±3.45µs 6.5 Ktx/sec 6.2 Ktx/sec
stdb_raw 💿 string indexed 1000 10 4.5±0.01µs 4.5±0.01µs 219.1 Ktx/sec 216.1 Ktx/sec
stdb_raw 💿 string non_indexed 1000 10 149.9±0.52µs 150.3±0.29µs 6.5 Ktx/sec 6.5 Ktx/sec
stdb_raw 💿 u64 indexed 1000 10 4.4±0.01µs 4.4±0.01µs 223.1 Ktx/sec 220.3 Ktx/sec
stdb_raw 💿 u64 non_indexed 1000 10 128.6±0.17µs 128.9±0.19µs 7.6 Ktx/sec 7.6 Ktx/sec
stdb_raw 🧠 string indexed 1000 10 4.4±0.01µs 4.5±0.01µs 219.8 Ktx/sec 217.6 Ktx/sec
stdb_raw 🧠 string non_indexed 1000 10 147.6±0.28µs 147.6±0.27µs 6.6 Ktx/sec 6.6 Ktx/sec
stdb_raw 🧠 u64 indexed 1000 10 4.4±0.01µs 4.4±0.01µs 223.8 Ktx/sec 221.8 Ktx/sec
stdb_raw 🧠 u64 non_indexed 1000 10 128.6±0.13µs 127.8±0.17µs 7.6 Ktx/sec 7.6 Ktx/sec

Serialize

schema format count new latency old latency new throughput old throughput
location bsatn 100 1665.2±36.36ns 1696.7±56.37ns 57.3 Mtx/sec 56.2 Mtx/sec
location json 100 3.3±0.07µs 3.3±0.03µs 28.5 Mtx/sec 29.0 Mtx/sec
location product_value 100 581.2±0.23ns 579.3±0.44ns 164.1 Mtx/sec 164.6 Mtx/sec
person bsatn 100 2.9±0.01µs 2.9±0.02µs 33.1 Mtx/sec 33.1 Mtx/sec
person json 100 5.2±0.04µs 5.0±0.03µs 18.5 Mtx/sec 18.9 Mtx/sec
person product_value 100 1007.1±0.75ns 1029.9±1.06ns 94.7 Mtx/sec 92.6 Mtx/sec

Module: invoke with large arguments

arg size new latency old latency new throughput old throughput
64KiB 78.7±9.36µs 80.3±3.03µs - -

Module: print bulk

line count new latency old latency new throughput old throughput
1 25.2±1.92µs 24.8±1.93µs - -
100 205.2±1.97µs 199.3±1.87µs - -
1000 1973.1±57.43µs 1835.2±27.70µs - -

Remaining benchmarks

name new latency old latency new throughput old throughput

Please sign in to comment.