Skip to content

Commit

Permalink
core: Make Segment pub and serde (#574)
Browse files Browse the repository at this point in the history
Turns out to be a useful type to send over the wire.
  • Loading branch information
kim authored Nov 18, 2023
1 parent a33fa53 commit 23b0faa
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions crates/core/src/db/message_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,20 @@ impl Default for OpenOptions {
}
}

#[derive(Clone, Copy, Debug)]
struct Segment {
min_offset: u64,
size: u64,
/// A segment of a [`MessageLog`].
///
/// Represents a physical file holding a subset of the log.
#[derive(Clone, Copy, Debug, serde::Serialize, serde::Deserialize)]
pub struct Segment {
/// Message offset this segment starts with (zero-based).
pub min_offset: u64,
/// Size in bytes of this segment.
pub size: u64,
}

impl Segment {
fn name(&self) -> String {
/// Name of this segment, as it appears in its file name.
pub fn name(&self) -> String {
format!("{:0>20}", self.min_offset)
}
}
Expand Down Expand Up @@ -480,6 +486,12 @@ impl SegmentView {
}
}

impl From<SegmentView> for Segment {
fn from(SegmentView { info, .. }: SegmentView) -> Self {
info
}
}

impl TryFrom<SegmentView> for IterSegment {
type Error = io::Error;

Expand Down

1 comment on commit 23b0faa

@github-actions
Copy link

@github-actions github-actions bot commented on 23b0faa Nov 18, 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 💿 438.9±2.36ns 429.9±0.67ns - -
sqlite 🧠 421.0±1.68ns 426.9±1.93ns - -
stdb_module 💿 16.9±0.94µs 17.4±1.04µs - -
stdb_module 🧠 17.7±1.20µs 17.3±0.81µs - -
stdb_raw 💿 730.4±1.18ns 731.9±1.52ns - -
stdb_raw 🧠 725.4±0.97ns 727.2±1.46ns - -

Single-row insertions

db on disk schema index type load new latency old latency new throughput old throughput
sqlite 💿 location multi_index 0 14.9±0.96µs 14.7±1.10µs 65.6 Ktx/sec 66.4 Ktx/sec
sqlite 💿 location multi_index 1000 16.0±0.11µs 15.8±0.73µs 61.1 Ktx/sec 61.7 Ktx/sec
sqlite 💿 location non_unique 0 7.3±0.74µs 7.1±0.28µs 133.1 Ktx/sec 138.2 Ktx/sec
sqlite 💿 location non_unique 1000 7.1±0.04µs 7.0±0.02µs 136.8 Ktx/sec 140.0 Ktx/sec
sqlite 💿 location unique 0 7.2±0.03µs 7.1±0.44µs 134.8 Ktx/sec 138.1 Ktx/sec
sqlite 💿 location unique 1000 7.2±0.03µs 7.0±0.03µs 135.3 Ktx/sec 140.1 Ktx/sec
sqlite 💿 person multi_index 0 14.8±0.90µs 14.2±0.05µs 66.1 Ktx/sec 68.7 Ktx/sec
sqlite 💿 person multi_index 1000 16.2±0.12µs 16.0±0.10µs 60.2 Ktx/sec 61.1 Ktx/sec
sqlite 💿 person non_unique 0 7.4±0.48µs 7.3±0.55µs 131.3 Ktx/sec 134.6 Ktx/sec
sqlite 💿 person non_unique 1000 7.3±0.04µs 7.1±0.05µs 134.2 Ktx/sec 136.7 Ktx/sec
sqlite 💿 person unique 0 7.3±0.05µs 7.1±0.05µs 133.1 Ktx/sec 136.9 Ktx/sec
sqlite 💿 person unique 1000 7.3±0.05µs 7.2±0.06µs 134.0 Ktx/sec 135.4 Ktx/sec
sqlite 🧠 location multi_index 0 4.0±0.01µs 3.9±0.01µs 242.1 Ktx/sec 249.3 Ktx/sec
sqlite 🧠 location multi_index 1000 5.2±0.09µs 5.1±0.03µs 188.5 Ktx/sec 190.9 Ktx/sec
sqlite 🧠 location non_unique 0 1847.3±7.46ns 1795.3±5.13ns 528.6 Ktx/sec 544.0 Ktx/sec
sqlite 🧠 location non_unique 1000 1928.1±7.27ns 1836.1±9.78ns 506.5 Ktx/sec 531.9 Ktx/sec
sqlite 🧠 location unique 0 1823.6±5.05ns 1774.7±3.98ns 535.5 Ktx/sec 550.3 Ktx/sec
sqlite 🧠 location unique 1000 1954.5±6.77ns 1910.0±16.63ns 499.7 Ktx/sec 511.3 Ktx/sec
sqlite 🧠 person multi_index 0 3.7±0.01µs 3.6±0.01µs 264.9 Ktx/sec 274.9 Ktx/sec
sqlite 🧠 person multi_index 1000 5.6±0.05µs 5.4±0.03µs 174.3 Ktx/sec 181.4 Ktx/sec
sqlite 🧠 person non_unique 0 1929.5±8.95ns 1849.6±9.04ns 506.1 Ktx/sec 528.0 Ktx/sec
sqlite 🧠 person non_unique 1000 2.0±0.01µs 1930.0±10.69ns 481.9 Ktx/sec 506.0 Ktx/sec
sqlite 🧠 person unique 0 1909.1±16.75ns 1838.8±8.02ns 511.5 Ktx/sec 531.1 Ktx/sec
sqlite 🧠 person unique 1000 2.0±0.01µs 1961.5±13.55ns 476.7 Ktx/sec 497.9 Ktx/sec
stdb_module 💿 location multi_index 0 101.8±490.45µs 52.1±5.66µs 9.6 Ktx/sec 18.7 Ktx/sec
stdb_module 💿 location multi_index 1000 71.1±32.10µs 129.7±23.09µs 13.7 Ktx/sec 7.5 Ktx/sec
stdb_module 💿 location non_unique 0 48.0±5.54µs 47.4±4.61µs 20.4 Ktx/sec 20.6 Ktx/sec
stdb_module 💿 location non_unique 1000 117.1±4.14µs 119.9±41.59µs 8.3 Ktx/sec 8.1 Ktx/sec
stdb_module 💿 location unique 0 45.0±4.96µs 51.1±6.24µs 21.7 Ktx/sec 19.1 Ktx/sec
stdb_module 💿 location unique 1000 77.0±29.17µs 248.1±3.90µs 12.7 Ktx/sec 3.9 Ktx/sec
stdb_module 💿 person multi_index 0 62.3±5.76µs 66.1±11.60µs 15.7 Ktx/sec 14.8 Ktx/sec
stdb_module 💿 person multi_index 1000 293.7±23.40µs 76.8±50.48µs 3.3 Ktx/sec 12.7 Ktx/sec
stdb_module 💿 person non_unique 0 47.5±4.98µs 49.1±4.21µs 20.5 Ktx/sec 19.9 Ktx/sec
stdb_module 💿 person non_unique 1000 117.2±36.01µs 258.3±106.99µs 8.3 Ktx/sec 3.8 Ktx/sec
stdb_module 💿 person unique 0 57.5±5.70µs 56.8±5.99µs 17.0 Ktx/sec 17.2 Ktx/sec
stdb_module 💿 person unique 1000 134.3±9.07µs 189.0±102.53µs 7.3 Ktx/sec 5.2 Ktx/sec
stdb_module 🧠 location multi_index 0 36.6±3.93µs 34.5±2.09µs 26.7 Ktx/sec 28.3 Ktx/sec
stdb_module 🧠 location multi_index 1000 107.5±9.55µs 94.5±3.30µs 9.1 Ktx/sec 10.3 Ktx/sec
stdb_module 🧠 location non_unique 0 29.1±2.38µs 29.4±2.74µs 33.6 Ktx/sec 33.3 Ktx/sec
stdb_module 🧠 location non_unique 1000 125.3±7.61µs 229.9±7.58µs 7.8 Ktx/sec 4.2 Ktx/sec
stdb_module 🧠 location unique 0 36.5±4.10µs 34.7±2.51µs 26.8 Ktx/sec 28.1 Ktx/sec
stdb_module 🧠 location unique 1000 129.0±8.85µs 190.0±31.23µs 7.6 Ktx/sec 5.1 Ktx/sec
stdb_module 🧠 person multi_index 0 44.8±4.24µs 44.0±5.20µs 21.8 Ktx/sec 22.2 Ktx/sec
stdb_module 🧠 person multi_index 1000 85.3±44.41µs 99.8±63.13µs 11.4 Ktx/sec 9.8 Ktx/sec
stdb_module 🧠 person non_unique 0 32.0±2.77µs 32.0±3.41µs 30.5 Ktx/sec 30.5 Ktx/sec
stdb_module 🧠 person non_unique 1000 256.4±6.53µs 173.5±3.55µs 3.8 Ktx/sec 5.6 Ktx/sec
stdb_module 🧠 person unique 0 37.6±3.76µs 35.5±3.63µs 25.9 Ktx/sec 27.5 Ktx/sec
stdb_module 🧠 person unique 1000 191.6±2.09µs 199.2±9.01µs 5.1 Ktx/sec 4.9 Ktx/sec
stdb_raw 💿 location multi_index 0 7.2±0.01µs 7.2±0.03µs 134.9 Ktx/sec 135.4 Ktx/sec
stdb_raw 💿 location multi_index 1000 10.0±0.23µs 31.5±216.86µs 98.1 Ktx/sec 31.0 Ktx/sec
stdb_raw 💿 location non_unique 0 4.8±0.01µs 4.8±0.02µs 205.5 Ktx/sec 203.2 Ktx/sec
stdb_raw 💿 location non_unique 1000 6.3±0.41µs 15.8±97.10µs 154.7 Ktx/sec 61.7 Ktx/sec
stdb_raw 💿 location unique 0 6.1±0.24µs 6.4±2.72µs 158.9 Ktx/sec 152.9 Ktx/sec
stdb_raw 💿 location unique 1000 8.5±0.23µs 14.4±60.24µs 114.4 Ktx/sec 68.0 Ktx/sec
stdb_raw 💿 person multi_index 0 11.0±0.48µs 10.9±0.51µs 88.7 Ktx/sec 89.2 Ktx/sec
stdb_raw 💿 person multi_index 1000 60.7±464.88µs 14.0±0.19µs 16.1 Ktx/sec 69.7 Ktx/sec
stdb_raw 💿 person non_unique 0 5.4±0.04µs 5.4±0.01µs 182.1 Ktx/sec 182.0 Ktx/sec
stdb_raw 💿 person non_unique 1000 7.0±0.25µs 6.9±0.26µs 139.2 Ktx/sec 140.7 Ktx/sec
stdb_raw 💿 person unique 0 7.7±0.01µs 7.7±0.02µs 126.3 Ktx/sec 126.1 Ktx/sec
stdb_raw 💿 person unique 1000 10.3±0.18µs 38.5±282.83µs 94.6 Ktx/sec 25.3 Ktx/sec
stdb_raw 🧠 location multi_index 0 4.2±0.01µs 4.2±0.01µs 234.2 Ktx/sec 234.5 Ktx/sec
stdb_raw 🧠 location multi_index 1000 5.8±0.03µs 5.6±0.02µs 168.3 Ktx/sec 173.4 Ktx/sec
stdb_raw 🧠 location non_unique 0 1944.3±5.91ns 1938.7±26.62ns 502.3 Ktx/sec 503.7 Ktx/sec
stdb_raw 🧠 location non_unique 1000 2.4±0.02µs 2.4±0.05µs 403.3 Ktx/sec 404.8 Ktx/sec
stdb_raw 🧠 location unique 0 3.2±0.01µs 3.1±0.01µs 308.7 Ktx/sec 310.9 Ktx/sec
stdb_raw 🧠 location unique 1000 4.3±0.04µs 4.3±0.02µs 225.2 Ktx/sec 227.5 Ktx/sec
stdb_raw 🧠 person multi_index 0 7.9±0.01µs 7.8±0.02µs 123.1 Ktx/sec 124.7 Ktx/sec
stdb_raw 🧠 person multi_index 1000 10.0±0.05µs 9.8±0.07µs 97.3 Ktx/sec 99.4 Ktx/sec
stdb_raw 🧠 person non_unique 0 2.5±0.01µs 2.5±0.00µs 393.8 Ktx/sec 397.0 Ktx/sec
stdb_raw 🧠 person non_unique 1000 3.2±0.02µs 3.2±0.02µs 301.5 Ktx/sec 307.6 Ktx/sec
stdb_raw 🧠 person unique 0 4.8±0.01µs 4.7±0.01µs 203.6 Ktx/sec 206.0 Ktx/sec
stdb_raw 🧠 person unique 1000 6.2±0.05µs 6.0±0.03µs 158.5 Ktx/sec 163.5 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.5±5.19µs 130.5±2.54µs 7.4 Ktx/sec 7.5 Ktx/sec
sqlite 💿 location multi_index 1000 100 203.2±2.21µs 200.6±1.14µs 4.8 Ktx/sec 4.9 Ktx/sec
sqlite 💿 location non_unique 0 100 50.6±2.30µs 48.2±1.02µs 19.3 Ktx/sec 20.3 Ktx/sec
sqlite 💿 location non_unique 1000 100 51.7±0.30µs 51.8±0.38µs 18.9 Ktx/sec 18.9 Ktx/sec
sqlite 💿 location unique 0 100 51.7±2.31µs 50.2±1.10µs 18.9 Ktx/sec 19.4 Ktx/sec
sqlite 💿 location unique 1000 100 57.4±21.11µs 55.3±0.64µs 17.0 Ktx/sec 17.7 Ktx/sec
sqlite 💿 person multi_index 0 100 119.4±3.45µs 117.0±4.76µs 8.2 Ktx/sec 8.3 Ktx/sec
sqlite 💿 person multi_index 1000 100 235.5±31.97µs 226.7±0.58µs 4.1 Ktx/sec 4.3 Ktx/sec
sqlite 💿 person non_unique 0 100 48.3±1.37µs 47.3±0.82µs 20.2 Ktx/sec 20.7 Ktx/sec
sqlite 💿 person non_unique 1000 100 60.0±0.34µs 59.3±0.27µs 16.3 Ktx/sec 16.5 Ktx/sec
sqlite 💿 person unique 0 100 50.8±5.86µs 49.6±0.55µs 19.2 Ktx/sec 19.7 Ktx/sec
sqlite 💿 person unique 1000 100 56.4±0.48µs 54.5±0.39µs 17.3 Ktx/sec 17.9 Ktx/sec
sqlite 🧠 location multi_index 0 100 118.7±0.48µs 117.6±0.38µs 8.2 Ktx/sec 8.3 Ktx/sec
sqlite 🧠 location multi_index 1000 100 169.7±0.45µs 167.4±0.48µs 5.8 Ktx/sec 5.8 Ktx/sec
sqlite 🧠 location non_unique 0 100 42.8±0.45µs 41.9±0.36µs 22.8 Ktx/sec 23.3 Ktx/sec
sqlite 🧠 location non_unique 1000 100 44.2±0.23µs 43.9±0.17µs 22.1 Ktx/sec 22.3 Ktx/sec
sqlite 🧠 location unique 0 100 45.0±0.47µs 44.1±0.22µs 21.7 Ktx/sec 22.1 Ktx/sec
sqlite 🧠 location unique 1000 100 49.0±0.24µs 47.5±0.33µs 19.9 Ktx/sec 20.6 Ktx/sec
sqlite 🧠 person multi_index 0 100 108.3±1.08µs 105.0±0.36µs 9.0 Ktx/sec 9.3 Ktx/sec
sqlite 🧠 person multi_index 1000 100 190.8±0.26µs 188.1±0.40µs 5.1 Ktx/sec 5.2 Ktx/sec
sqlite 🧠 person non_unique 0 100 42.9±0.45µs 42.5±0.42µs 22.8 Ktx/sec 23.0 Ktx/sec
sqlite 🧠 person non_unique 1000 100 46.1±0.25µs 45.3±0.35µs 21.2 Ktx/sec 21.6 Ktx/sec
sqlite 🧠 person unique 0 100 44.4±0.31µs 44.2±0.21µs 22.0 Ktx/sec 22.1 Ktx/sec
sqlite 🧠 person unique 1000 100 48.8±0.46µs 47.0±0.50µs 20.0 Ktx/sec 20.8 Ktx/sec
stdb_module 💿 location multi_index 0 100 940.6±113.03µs 805.3±169.17µs 1063 tx/sec 1241 tx/sec
stdb_module 💿 location multi_index 1000 100 710.6±88.75µs 1205.8±130.09µs 1407 tx/sec 829 tx/sec
stdb_module 💿 location non_unique 0 100 483.4±69.98µs 615.0±29.48µs 2.0 Ktx/sec 1625 tx/sec
stdb_module 💿 location non_unique 1000 100 706.9±64.74µs 806.2±31.02µs 1414 tx/sec 1240 tx/sec
stdb_module 💿 location unique 0 100 501.3±45.74µs 731.7±118.49µs 1994 tx/sec 1366 tx/sec
stdb_module 💿 location unique 1000 100 547.4±65.85µs 773.1±5.60µs 1826 tx/sec 1293 tx/sec
stdb_module 💿 person multi_index 0 100 1057.1±70.56µs 980.8±33.21µs 945 tx/sec 1019 tx/sec
stdb_module 💿 person multi_index 1000 100 1170.0±55.80µs 1162.8±7.10µs 854 tx/sec 859 tx/sec
stdb_module 💿 person non_unique 0 100 635.0±122.66µs 662.9±98.45µs 1574 tx/sec 1508 tx/sec
stdb_module 💿 person non_unique 1000 100 722.9±162.54µs 753.1±75.30µs 1383 tx/sec 1327 tx/sec
stdb_module 💿 person unique 0 100 783.9±22.40µs 774.0±6.36µs 1275 tx/sec 1292 tx/sec
stdb_module 💿 person unique 1000 100 956.5±50.13µs 911.3±52.88µs 1045 tx/sec 1097 tx/sec
stdb_module 🧠 location multi_index 0 100 761.6±6.05µs 452.4±1.81µs 1312 tx/sec 2.2 Ktx/sec
stdb_module 🧠 location multi_index 1000 100 873.2±75.08µs 629.4±4.92µs 1145 tx/sec 1588 tx/sec
stdb_module 🧠 location non_unique 0 100 323.2±30.49µs 234.5±20.94µs 3.0 Ktx/sec 4.2 Ktx/sec
stdb_module 🧠 location non_unique 1000 100 446.1±58.49µs 373.2±6.78µs 2.2 Ktx/sec 2.6 Ktx/sec
stdb_module 🧠 location unique 0 100 390.6±58.02µs 400.3±45.45µs 2.5 Ktx/sec 2.4 Ktx/sec
stdb_module 🧠 location unique 1000 100 640.7±7.53µs 516.0±54.57µs 1560 tx/sec 1937 tx/sec
stdb_module 🧠 person multi_index 0 100 878.6±30.27µs 802.5±0.65µs 1138 tx/sec 1246 tx/sec
stdb_module 🧠 person multi_index 1000 100 1060.7±47.20µs 881.9±10.13µs 942 tx/sec 1133 tx/sec
stdb_module 🧠 person non_unique 0 100 464.8±81.91µs 429.2±60.59µs 2.1 Ktx/sec 2.3 Ktx/sec
stdb_module 🧠 person non_unique 1000 100 558.5±71.56µs 501.7±3.04µs 1790 tx/sec 1993 tx/sec
stdb_module 🧠 person unique 0 100 581.6±1.44µs 618.0±1.14µs 1719 tx/sec 1618 tx/sec
stdb_module 🧠 person unique 1000 100 750.7±3.13µs 742.3±5.99µs 1332 tx/sec 1347 tx/sec
stdb_raw 💿 location multi_index 0 100 396.2±1.08µs 397.3±25.79µs 2.5 Ktx/sec 2.5 Ktx/sec
stdb_raw 💿 location multi_index 1000 100 446.3±237.36µs 451.9±308.45µs 2.2 Ktx/sec 2.2 Ktx/sec
stdb_raw 💿 location non_unique 0 100 171.2±1.13µs 172.3±7.02µs 5.7 Ktx/sec 5.7 Ktx/sec
stdb_raw 💿 location non_unique 1000 100 185.1±106.14µs 174.0±0.96µs 5.3 Ktx/sec 5.6 Ktx/sec
stdb_raw 💿 location unique 0 100 296.8±0.32µs 293.7±0.48µs 3.3 Ktx/sec 3.3 Ktx/sec
stdb_raw 💿 location unique 1000 100 337.2±223.65µs 331.9±175.35µs 2.9 Ktx/sec 2.9 Ktx/sec
stdb_raw 💿 person multi_index 0 100 731.8±2.68µs 719.1±1.46µs 1366 tx/sec 1390 tx/sec
stdb_raw 💿 person multi_index 1000 100 806.2±479.91µs 798.2±488.64µs 1240 tx/sec 1252 tx/sec
stdb_raw 💿 person non_unique 0 100 228.6±0.71µs 227.4±2.31µs 4.3 Ktx/sec 4.3 Ktx/sec
stdb_raw 💿 person non_unique 1000 100 252.1±204.56µs 229.4±0.58µs 3.9 Ktx/sec 4.3 Ktx/sec
stdb_raw 💿 person unique 0 100 441.8±14.87µs 436.8±1.79µs 2.2 Ktx/sec 2.2 Ktx/sec
stdb_raw 💿 person unique 1000 100 457.9±1.06µs 478.0±229.36µs 2.1 Ktx/sec 2.0 Ktx/sec
stdb_raw 🧠 location multi_index 0 100 295.9±0.82µs 299.4±0.73µs 3.3 Ktx/sec 3.3 Ktx/sec
stdb_raw 🧠 location multi_index 1000 100 321.0±0.40µs 324.2±0.41µs 3.0 Ktx/sec 3.0 Ktx/sec
stdb_raw 🧠 location non_unique 0 100 75.5±0.10µs 75.3±0.79µs 12.9 Ktx/sec 13.0 Ktx/sec
stdb_raw 🧠 location non_unique 1000 100 76.6±0.17µs 76.6±0.20µs 12.7 Ktx/sec 12.8 Ktx/sec
stdb_raw 🧠 location unique 0 100 199.4±0.40µs 198.0±0.22µs 4.9 Ktx/sec 4.9 Ktx/sec
stdb_raw 🧠 location unique 1000 100 217.9±0.30µs 216.8±0.31µs 4.5 Ktx/sec 4.5 Ktx/sec
stdb_raw 🧠 person multi_index 0 100 625.4±1.59µs 616.6±0.51µs 1598 tx/sec 1621 tx/sec
stdb_raw 🧠 person multi_index 1000 100 655.0±1.54µs 646.8±0.57µs 1526 tx/sec 1545 tx/sec
stdb_raw 🧠 person non_unique 0 100 127.6±0.11µs 126.1±0.11µs 7.7 Ktx/sec 7.7 Ktx/sec
stdb_raw 🧠 person non_unique 1000 100 130.4±0.22µs 128.1±0.22µs 7.5 Ktx/sec 7.6 Ktx/sec
stdb_raw 🧠 person unique 0 100 338.8±0.26µs 335.8±0.45µs 2.9 Ktx/sec 2.9 Ktx/sec
stdb_raw 🧠 person unique 1000 100 357.8±0.48µs 354.2±0.61µs 2.7 Ktx/sec 2.8 Ktx/sec

Full table iterate

db on disk schema index type new latency old latency new throughput old throughput
sqlite 💿 location unique 8.9±0.10µs 8.8±0.07µs 109.8 Ktx/sec 111.0 Ktx/sec
sqlite 💿 person unique 9.3±0.11µs 9.1±0.09µs 104.9 Ktx/sec 107.8 Ktx/sec
sqlite 🧠 location unique 7.7±0.06µs 7.6±0.11µs 127.2 Ktx/sec 128.9 Ktx/sec
sqlite 🧠 person unique 8.0±0.09µs 7.7±0.10µs 122.1 Ktx/sec 126.1 Ktx/sec
stdb_module 💿 location unique 49.9±6.50µs 46.6±4.64µs 19.6 Ktx/sec 20.9 Ktx/sec
stdb_module 💿 person unique 61.1±6.50µs 58.2±6.12µs 16.0 Ktx/sec 16.8 Ktx/sec
stdb_module 🧠 location unique 47.7±6.41µs 48.3±3.90µs 20.5 Ktx/sec 20.2 Ktx/sec
stdb_module 🧠 person unique 60.1±10.60µs 53.8±8.48µs 16.3 Ktx/sec 18.2 Ktx/sec
stdb_raw 💿 location unique 9.2±0.02µs 8.9±0.01µs 106.4 Ktx/sec 109.1 Ktx/sec
stdb_raw 💿 person unique 9.2±0.04µs 9.0±0.01µs 106.4 Ktx/sec 109.1 Ktx/sec
stdb_raw 🧠 location unique 9.2±0.27µs 8.9±0.01µs 105.8 Ktx/sec 109.2 Ktx/sec
stdb_raw 🧠 person unique 9.2±0.03µs 8.9±0.01µs 106.5 Ktx/sec 109.2 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.01µs 2.3±0.01µs 414.9 Ktx/sec 431.0 Ktx/sec
sqlite 🧠 u32 1000 1137.5±6.90ns 1092.0±5.05ns 858.5 Ktx/sec 894.3 Ktx/sec
stdb_module 💿 u32 1000 22.9±1.67µs 24.6±1.61µs 42.6 Ktx/sec 39.7 Ktx/sec
stdb_module 🧠 u32 1000 23.4±1.67µs 23.4±1.57µs 41.8 Ktx/sec 41.8 Ktx/sec
stdb_raw 💿 u32 1000 1929.1±2.69ns 1937.3±16.51ns 506.2 Ktx/sec 504.1 Ktx/sec
stdb_raw 🧠 u32 1000 1926.9±3.64ns 1926.3±2.41ns 506.8 Ktx/sec 507.0 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.5±0.02µs 173.5 Ktx/sec 176.6 Ktx/sec
sqlite 💿 string non_indexed 1000 10 48.8±0.26µs 46.9±0.51µs 20.0 Ktx/sec 20.8 Ktx/sec
sqlite 💿 u64 indexed 1000 10 5.4±0.02µs 5.3±0.01µs 180.7 Ktx/sec 183.8 Ktx/sec
sqlite 💿 u64 non_indexed 1000 10 33.1±0.12µs 32.8±0.06µs 29.5 Ktx/sec 29.8 Ktx/sec
sqlite 🧠 string indexed 1000 10 4.2±0.02µs 4.1±0.02µs 231.8 Ktx/sec 237.8 Ktx/sec
sqlite 🧠 string non_indexed 1000 10 47.0±0.17µs 44.8±0.47µs 20.8 Ktx/sec 21.8 Ktx/sec
sqlite 🧠 u64 indexed 1000 10 4.0±0.02µs 3.9±0.01µs 242.2 Ktx/sec 248.7 Ktx/sec
sqlite 🧠 u64 non_indexed 1000 10 31.8±0.25µs 31.6±0.07µs 30.7 Ktx/sec 30.9 Ktx/sec
stdb_module 💿 string indexed 1000 10 34.2±3.36µs 35.3±1.69µs 28.6 Ktx/sec 27.7 Ktx/sec
stdb_module 💿 string non_indexed 1000 10 185.4±3.72µs 173.4±6.21µs 5.3 Ktx/sec 5.6 Ktx/sec
stdb_module 💿 u64 indexed 1000 10 29.9±2.94µs 33.1±3.39µs 32.7 Ktx/sec 29.5 Ktx/sec
stdb_module 💿 u64 non_indexed 1000 10 151.7±3.79µs 140.7±5.27µs 6.4 Ktx/sec 6.9 Ktx/sec
stdb_module 🧠 string indexed 1000 10 34.5±2.57µs 34.7±2.39µs 28.3 Ktx/sec 28.2 Ktx/sec
stdb_module 🧠 string non_indexed 1000 10 182.0±2.66µs 167.0±2.83µs 5.4 Ktx/sec 5.8 Ktx/sec
stdb_module 🧠 u64 indexed 1000 10 29.1±2.83µs 32.2±2.04µs 33.6 Ktx/sec 30.3 Ktx/sec
stdb_module 🧠 u64 non_indexed 1000 10 157.1±7.74µs 138.5±0.99µs 6.2 Ktx/sec 7.1 Ktx/sec
stdb_raw 💿 string indexed 1000 10 4.3±0.01µs 4.4±0.01µs 226.1 Ktx/sec 220.4 Ktx/sec
stdb_raw 💿 string non_indexed 1000 10 142.9±0.31µs 132.6±0.49µs 6.8 Ktx/sec 7.4 Ktx/sec
stdb_raw 💿 u64 indexed 1000 10 4.2±0.01µs 4.3±0.01µs 234.6 Ktx/sec 225.1 Ktx/sec
stdb_raw 💿 u64 non_indexed 1000 10 121.8±0.15µs 113.7±0.16µs 8.0 Ktx/sec 8.6 Ktx/sec
stdb_raw 🧠 string indexed 1000 10 4.3±0.02µs 4.4±0.01µs 226.4 Ktx/sec 221.1 Ktx/sec
stdb_raw 🧠 string non_indexed 1000 10 141.0±2.21µs 129.6±1.52µs 6.9 Ktx/sec 7.5 Ktx/sec
stdb_raw 🧠 u64 indexed 1000 10 4.2±0.01µs 4.3±0.01µs 235.0 Ktx/sec 226.3 Ktx/sec
stdb_raw 🧠 u64 non_indexed 1000 10 121.5±0.30µs 112.9±0.20µs 8.0 Ktx/sec 8.7 Ktx/sec

Serialize

schema format count new latency old latency new throughput old throughput
location bsatn 100 1766.4±32.72ns 1696.4±42.36ns 54.0 Mtx/sec 56.2 Mtx/sec
location json 100 3.1±0.01µs 4.2±0.01µs 30.4 Mtx/sec 22.9 Mtx/sec
location product_value 100 598.8±0.24ns 572.6±0.44ns 159.3 Mtx/sec 166.6 Mtx/sec
person bsatn 100 2.5±0.02µs 2.9±0.01µs 37.4 Mtx/sec 33.2 Mtx/sec
person json 100 4.6±0.02µs 5.8±0.06µs 20.6 Mtx/sec 16.5 Mtx/sec
person product_value 100 1006.2±1.38ns 1006.2±0.72ns 94.8 Mtx/sec 94.8 Mtx/sec

Module: invoke with large arguments

arg size new latency old latency new throughput old throughput
64KiB 58.0±7.69µs 70.0±6.22µs - -

Module: print bulk

line count new latency old latency new throughput old throughput
1 21.8±0.81µs 22.3±1.46µs - -
100 197.1±6.61µs 191.6±4.33µs - -
1000 1774.7±87.54µs 1749.7±155.95µs - -

Remaining benchmarks

name new latency old latency new throughput old throughput

Please sign in to comment.