Skip to content

Commit ccffc13

Browse files
konardclaude
andcommitted
Fix formatting and file size CI failures
- Fix rustfmt errors in rust/src/lib.rs (remove extra blank line) - Fix rustfmt errors in rust/src/spacetimedb_impl.rs (expand struct literal and reformat if-let method chain per nightly rustfmt rules) - Exclude vendored bumpalo-patched and doublets-patched dirs from file size check (they are third-party libraries, not project code) - Update changelog fragment to accurately describe real SpacetimeDB 2.0 engine usage (no SQLite, uses RelationalDB/TestDB in-memory) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 670f953 commit ccffc13

4 files changed

Lines changed: 17 additions & 10 deletions

File tree

changelog.d/20260224_spacetimedb_vs_doublets_benchmark.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ bump: minor
44

55
### Added
66

7-
- **SpacetimeDB 2 vs Doublets benchmark** (`rust/`): New Rust benchmark suite comparing SpacetimeDB's SQLite backend against Doublets in-memory link stores for basic CRUD operations, following best practices from the Neo4j and PostgreSQL comparison benchmarks.
7+
- **SpacetimeDB 2 vs Doublets benchmark** (`rust/`): New Rust benchmark suite comparing the real SpacetimeDB 2.0 engine against Doublets in-memory link stores for basic CRUD operations.
88

99
- **7 benchmark operations**: Create, Delete, Update, Query All, Query by Id, Query by Source, Query by Target
10-
- **3 backends**: SpacetimeDB Memory (SQLite/WAL), Doublets United Volatile, Doublets Split Volatile
10+
- **3 backends**: SpacetimeDB 2.0 in-memory (via `RelationalDB`/`TestDB`), Doublets United Volatile, Doublets Split Volatile
1111
- **Configurable scale**: `BENCHMARK_LINK_COUNT` and `BACKGROUND_LINK_COUNT` environment variables
1212
- **Criterion harness**: Uses criterion 0.3.6 with custom `iter_custom` timing to exclude setup/teardown from measurements
1313
- **Fork/unfork lifecycle**: Each iteration starts from a clean database state with pre-populated background links
1414

1515
- **`rust/src/lib.rs`**: `Links` trait as the shared interface for both SpacetimeDB and Doublets backends; `Benched` trait for benchmark lifecycle management.
1616

17-
- **`rust/src/spacetimedb_impl.rs`**: SpacetimeDB SQLite client implementing the `Links` trait using the same schema and indexes that SpacetimeDB 2 uses internally.
17+
- **`rust/src/spacetimedb_impl.rs`**: Real SpacetimeDB 2.0 engine implementation using `spacetimedb-core` with `TestDB` (in-memory `RelationalDB`, no SQLite). Verifies engine version at startup and fails if backend ≠ SpacetimeDB 2.0+.
1818

1919
- **`rust/src/doublets_impl.rs`**: Doublets store adapters implementing the `Links` trait for both United Volatile and Split Volatile storage layouts.
2020

rust/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
66
#![feature(allocator_api)]
77

8-
98
pub mod benched;
109
pub mod doublets_impl;
1110
pub mod exclusive;

rust/src/spacetimedb_impl.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ impl SpacetimeDbLinks {
7878
})
7979
.expect("Failed to create links table");
8080

81-
Self { db, table_id, next_id: 1 }
81+
Self {
82+
db,
83+
table_id,
84+
next_id: 1,
85+
}
8286
}
8387

8488
/// Serialize a link row into BSATN bytes for insertion into the SpacetimeDB engine.
@@ -136,8 +140,10 @@ impl Links for SpacetimeDbLinks {
136140
self.db
137141
.with_auto_commit(Workload::Internal, |tx| {
138142
// Find and delete the old row, then insert the updated row.
139-
if let Some(row_ref) =
140-
self.db.iter_by_col_eq_mut(tx, table_id, COL_ID, &id_val)?.next()
143+
if let Some(row_ref) = self
144+
.db
145+
.iter_by_col_eq_mut(tx, table_id, COL_ID, &id_val)?
146+
.next()
141147
{
142148
let ptr = row_ref.pointer();
143149
self.db.delete(tx, table_id, [ptr]);
@@ -152,8 +158,10 @@ impl Links for SpacetimeDbLinks {
152158
let id_val = AlgebraicValue::U64(id);
153159
self.db
154160
.with_auto_commit(Workload::Internal, |tx| {
155-
if let Some(row_ref) =
156-
self.db.iter_by_col_eq_mut(tx, table_id, COL_ID, &id_val)?.next()
161+
if let Some(row_ref) = self
162+
.db
163+
.iter_by_col_eq_mut(tx, table_id, COL_ID, &id_val)?
164+
.next()
157165
{
158166
let ptr = row_ref.pointer();
159167
self.db.delete(tx, table_id, [ptr]);

scripts/check-file-size.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { join, relative, extname } from 'path';
1313

1414
const MAX_LINES = 1000;
1515
const FILE_EXTENSIONS = ['.rs'];
16-
const EXCLUDE_PATTERNS = ['target', '.git', 'node_modules'];
16+
const EXCLUDE_PATTERNS = ['target', '.git', 'node_modules', 'bumpalo-patched', 'doublets-patched'];
1717

1818
/**
1919
* Check if a path should be excluded

0 commit comments

Comments
 (0)