Skip to content

Commit

Permalink
commitlog: Fix transactions iterator (#1884)
Browse files Browse the repository at this point in the history
  • Loading branch information
kim authored Oct 22, 2024
1 parent 437eed7 commit 98d408b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/commitlog/src/commitlog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,10 @@ where
T: 'a,
{
commits
.map(|x| x.map_err(Into::into))
.map(|x| x.map_err(D::Error::from))
.map_ok(move |(version, commit)| commit.into_transactions(version, de))
.flatten_ok()
.flatten_ok()
.map(|x| x.and_then(|y| y))
.skip_while(move |x| x.as_ref().map(|tx| tx.offset < offset).unwrap_or(false))
}

Expand Down

2 comments on commit 98d408b

@github-actions
Copy link

@github-actions github-actions bot commented on 98d408b Oct 22, 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 98d408b Oct 22, 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 5392 5392 0.00% 5500 5500 0.00%
sqlite 5579 5579 0.00% 5963 5963 0.00%

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 1 u64 75558 75558 0.00% 76060 76064 -0.01%
stdb_raw u32_u64_str no_index 64 128 2 string 117800 117800 0.00% 118408 118388 0.02%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24107 24107 0.00% 24679 24667 0.05%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23075 23075 0.00% 23481 23493 -0.05%
sqlite u32_u64_str no_index 64 128 2 string 144695 144695 0.00% 146091 146091 0.00%
sqlite u32_u64_str no_index 64 128 1 u64 124044 124044 0.00% 125194 125194 0.00%
sqlite u32_u64_str btree_each_column 64 128 1 u64 131361 131361 0.00% 132807 132807 0.00%
sqlite u32_u64_str btree_each_column 64 128 2 string 134494 134494 0.00% 136166 136170 -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 900426 900426 0.00% 948796 948668 0.01%
stdb_raw u32_u64_str btree_each_column 64 128 1049370 1047357 0.19% 1103980 1102171 0.16%
sqlite u32_u64_str unique_0 64 128 398320 398320 0.00% 417272 417276 -0.00%
sqlite u32_u64_str btree_each_column 64 128 983637 983637 0.00% 1020261 1020261 0.00%

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 152784 152784 0.00% 152894 152894 0.00%
stdb_raw u32_u64_str unique_0 64 15809 15809 0.00% 15911 15911 0.00%
sqlite u32_u64_str unique_0 1024 1067255 1067255 0.00% 1070565 1070565 0.00%
sqlite u32_u64_str unique_0 64 76201 76201 0.00% 77249 77249 0.00%

callgrind: serialize_product_value

count format total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
64 json 47528 47528 0.00% 50150 50150 0.00%
64 bsatn 25509 25509 0.00% 27685 27685 0.00%
16 bsatn 8200 8200 0.00% 9492 9492 0.00%
16 json 12188 12188 0.00% 14024 14024 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 20566931 20989494 -2.01% 20982609 21420508 -2.04%
stdb_raw u32_u64_str unique_0 64 128 1310977 1310919 0.00% 1373555 1373573 -0.00%
sqlite u32_u64_str unique_0 1024 1024 1802128 1802128 0.00% 1811580 1811580 0.00%
sqlite u32_u64_str unique_0 64 128 128474 128474 0.00% 131368 131368 0.00%
On-disk benchmarks

callgrind: empty transaction

db total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw 5397 5397 0.00% 5501 5509 -0.15%
sqlite 5621 5621 0.00% 6057 6057 0.00%

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 1 u64 75563 75563 0.00% 76061 76061 0.00%
stdb_raw u32_u64_str no_index 64 128 2 string 117805 117805 0.00% 118457 118345 0.09%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24118 24112 0.02% 24654 24664 -0.04%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23080 23080 0.00% 23490 23490 0.00%
sqlite u32_u64_str no_index 64 128 1 u64 125965 125965 0.00% 127419 127423 -0.00%
sqlite u32_u64_str no_index 64 128 2 string 146616 146616 0.00% 148276 148280 -0.00%
sqlite u32_u64_str btree_each_column 64 128 2 string 136616 136616 0.00% 138622 138622 0.00%
sqlite u32_u64_str btree_each_column 64 128 1 u64 133457 133457 0.00% 135335 135335 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 849457 850292 -0.10% 896479 897392 -0.10%
stdb_raw u32_u64_str btree_each_column 64 128 999760 999451 0.03% 1052714 1052793 -0.01%
sqlite u32_u64_str unique_0 64 128 415857 415857 0.00% 434111 434111 0.00%
sqlite u32_u64_str btree_each_column 64 128 1021904 1021898 0.00% 1057182 1057180 0.00%

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 152789 152789 0.00% 152891 152891 0.00%
stdb_raw u32_u64_str unique_0 64 15814 15814 0.00% 15916 15916 0.00%
sqlite u32_u64_str unique_0 1024 1070323 1070323 0.00% 1074079 1074079 0.00%
sqlite u32_u64_str unique_0 64 77991 77973 0.02% 79255 79233 0.03%

callgrind: serialize_product_value

count format total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
64 json 47528 47528 0.00% 50150 50150 0.00%
64 bsatn 25509 25509 0.00% 27685 27685 0.00%
16 bsatn 8200 8200 0.00% 9492 9492 0.00%
16 json 12188 12188 0.00% 14024 14024 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 19480940 19483651 -0.01% 19956404 19972923 -0.08%
stdb_raw u32_u64_str unique_0 64 128 1264545 1264907 -0.03% 1325121 1326027 -0.07%
sqlite u32_u64_str unique_0 1024 1024 1809689 1809689 0.00% 1818375 1818375 0.00%
sqlite u32_u64_str unique_0 64 128 132600 132600 0.00% 135646 135646 0.00%

Please sign in to comment.