Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions nexum_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ log = "0.4"
[dev-dependencies]
tempfile = "3.24"
criterion = { version = "0.5", features = ["html_reports"] }
rusqlite = "0.31.0" # To interface with SQLite for comparison

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

rusqlite crate latest version crates.io

💡 Result:

The latest rusqlite version on crates.io is 0.38.0. [1][2]

Cargo.toml:

rusqlite = "0.38.0"

Sources: [1][2]


🌐 Web query:

rusqlite 0.31.0 security advisory vulnerability

💡 Result:

No specific security advisory appears to target rusqlite 0.31.0. The two main RustSec advisories for rusqlite list affected versions older than 0.31.0, meaning 0.31.0 is not in their vulnerable ranges:

  • RUSTSEC-2020-0014 (various memory safety issues): affects rusqlite < 0.23.0, patched in >= 0.23.0. [1]
  • RUSTSEC-2021-0128 (incorrect lifetime bounds / use-after-free across several APIs): affects >= 0.25.0 and < 0.25.4, and >= 0.26.0 and < 0.26.2, patched in 0.25.4 / 0.26.2 (and later). [2]

For context, rusqlite 0.31.0 is a later release line than those fixed versions. [3]

Sources: [1] [2] [3]


🏁 Script executed:

# Check if there are any known rusqlite vulnerabilities in the Rust advisory database
# by searching for related crate versions
rg -i "rusqlite" --type toml . 2>/dev/null | head -20

Repository: aviralgarg05/NexumDB

Length of output: 206


Update rusqlite to the latest version.

rusqlite 0.31.0 is free of known security advisories, but version 0.38.0 is the current latest release. Consider updating to benefit from bug fixes and improvements across 7 minor versions.

🤖 Prompt for AI Agents
In `@nexum_core/Cargo.toml` at line 26, Update the rusqlite dependency in
Cargo.toml from "0.31.0" to the latest "0.38.0" (replace the rusqlite = "0.31.0"
line with rusqlite = "0.38.0"), then run cargo update -p rusqlite and cargo
build/test to surface any breaking changes; if the build fails, inspect and
update usages of rusqlite APIs (e.g., Connection, params!, named_params!,
Transaction methods) to match the 0.38.0 API.


[[bench]]
name = "db_comparison"
harness = false

[[bench]]
name = "storage_bench"
Expand Down
45 changes: 44 additions & 1 deletion nexum_core/benches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,51 @@
This directory contains comprehensive performance benchmarks for the `nexum_core` module using the [Criterion](https://github.com/bheisler/criterion.rs) benchmarking framework.

## Benchmark Categories
## Performance & Benchmarks (Feb 2026)
Comment on lines 5 to +6

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Orphaned heading: "Benchmark Categories" has no content before the next heading.

Line 5 (## Benchmark Categories) is immediately followed by line 6 (## Performance & Benchmarks (Feb 2026)). This looks like a merge artifact — the old heading should be removed, or the new heading should replace it. This also triggers the markdownlint MD022 warning about missing blank lines around headings.

🧹 Proposed fix
-## Benchmark Categories
 ## Performance & Benchmarks (Feb 2026)
+
 To maintain the high performance expected of a Rust-based engine, NexumDB is continuously benchmarked against SQLite using the `criterion` suite.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Benchmark Categories
## Performance & Benchmarks (Feb 2026)
## Performance & Benchmarks (Feb 2026)
To maintain the high performance expected of a Rust-based engine, NexumDB is continuously benchmarked against SQLite using the `criterion` suite.
🧰 Tools
🪛 markdownlint-cli2 (0.20.0)

[warning] 5-5: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 6-6: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)


[warning] 6-6: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🤖 Prompt for AI Agents
In `@nexum_core/benches/README.md` around lines 5 - 6, Remove the orphaned heading
"## Benchmark Categories" that is immediately followed by "## Performance &
Benchmarks (Feb 2026)" in the README; either delete the "## Benchmark
Categories" line or merge its intent into "## Performance & Benchmarks (Feb
2026)" and ensure a blank line before the remaining heading to satisfy
markdownlint MD022. Locate the headings by their exact text ("## Benchmark
Categories" and "## Performance & Benchmarks (Feb 2026)"), remove or replace the
former, and add a single blank line above the retained heading.

To maintain the high performance expected of a Rust-based engine, NexumDB is continuously benchmarked against SQLite using the `criterion` suite.

### 1. Storage Engine Benchmarks (`storage_bench.rs`)
### Comparative Performance Results
| Operation | SQLite | NexumDB | Delta |
| :--- | :--- | :--- | :--- |
| **Single INSERT** | 15.18 ms | **7.48 ms** | NexumDB ~2x Faster |
| **Point SELECT (Cold)** | **140.5 µs** | 1.86 ms | SQLite Faster |
| **Point SELECT (Cached)**| **143.8 µs** | 1.87 ms | SQLite Faster |
Comment on lines +10 to +14

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Benchmark results are based on flawed comparison benchmarks.

The SELECT results in this table are invalid because the underlying benchmark (db_comparison.rs) inserts all NexumDB rows with id=1 and then queries WHERE id = 500, which matches zero rows vs. one row in SQLite. The "Cold" vs "Cached" distinction is also meaningless since no cache is enabled. These numbers should be updated once the benchmark bugs are fixed.

🧰 Tools
🪛 markdownlint-cli2 (0.20.0)

[warning] 10-10: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

🤖 Prompt for AI Agents
In `@nexum_core/benches/README.md` around lines 10 - 14, The benchmark SELECT
numbers are invalid because db_comparison.rs inserts NexumDB rows all with id=1
then queries WHERE id = 500 (zero matches) and labels Cold/Cached without
enabling a cache; fix db_comparison.rs by generating unique IDs for inserted
rows (e.g., use the loop index or a proper primary key) and make the SELECT
query target an existing id (or benchmark point selects by key present in the
dataset), remove or correctly implement the caching scenario (enable the cache
before the Cached run or drop the Cached/Cold distinction), then re-run the
benchmarks and update the README table in nexum_core/benches/README.md with the
corrected timings.


### Analysis
![Benchmark Visualization](./nexum_core/benches/bench_results.png)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Broken image path — relative reference is wrong.

This README lives at nexum_core/benches/README.md, so the image path ./nexum_core/benches/bench_results.png resolves to nexum_core/benches/nexum_core/benches/bench_results.png, which doesn't exist. It should be ./bench_results.png.

-![Benchmark Visualization](./nexum_core/benches/bench_results.png)
+![Benchmark Visualization](./bench_results.png)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
![Benchmark Visualization](./nexum_core/benches/bench_results.png)
![Benchmark Visualization](./bench_results.png)
🤖 Prompt for AI Agents
In `@nexum_core/benches/README.md` at line 17, The image reference in the README
uses an incorrect nested path; update the markdown image tag on the line showing
"![Benchmark Visualization](./nexum_core/benches/bench_results.png)" to point to
the local file name (e.g., "![Benchmark Visualization](./bench_results.png)") so
the link resolves correctly from the README in nexum_core/benches; change only
the path in that image tag.


### Architectural Insights

#### 1. Write Throughput: The LSM-Tree Advantage
NexumDB’s storage engine (`sled`) utilizes a **Log-Structured Merge-tree (LSM-tree)**, whereas SQLite uses a traditional **B-tree**.
* **LSM-tree (NexumDB):** Optimizes for writes by batching updates into immutable segments, leading to the 2x speedup observed in our `INSERT` benchmarks.
* **B-tree (SQLite):** Optimized for reads. Every write requires finding a leaf node on disk, which involves more synchronous I/O.



#### 2. Read Latency & AI Overhead
In small-scale point lookups (1,000 rows), SQLite's raw C-speed is superior. NexumDB's current ~1.8ms latency includes:
* **SQL Parsing**: Converting strings to `Statement` enums.
* **PyO3 Bridge**: The overhead of crossing the Rust-Python boundary for AI-native planning.
* **Semantic Caching**: The current benchmark dataset is too small to show the "skip-the-disk" benefits of semantic caching, which scale exponentially with query complexity and data volume.
Comment on lines +29 to +32

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Claims about PyO3 bridge overhead are unsupported by the benchmark.

The benchmark executor is created without .with_cache(), so the PyO3 bridge and semantic caching layers are never invoked during the benchmarked operations. The ~1.8ms latency comes from SQL parsing + sled scan, not from Python interop. This section should be corrected after the benchmarks are fixed.

🤖 Prompt for AI Agents
In `@nexum_core/benches/README.md` around lines 29 - 32, The README's claim that
PyO3 bridge and semantic caching contribute to the ~1.8ms latency is incorrect
because the benchmark executor is created without .with_cache(), so those layers
are never invoked; update the README text (the paragraph discussing "PyO3
Bridge" and "Semantic Caching") to remove or reword claims about
PyO3/semantic-caching overhead and instead state that the current benchmark
measures SQL parsing + sled scan only, and add a note that accurate measurement
of PyO3/semantic-caching requires creating the executor with .with_cache() and
re-running the benchmarks.


---

## Architecture
* **Core System**: Rust-based storage engine using `sled`, with SQL parsing and intelligent execution.
* **AI Engine**: Python-based semantic caching, NL translation, and RL optimization via local models.
* **Integration**: PyO3 bindings for seamless Rust-Python interoperability.



## Features
### v0.4.0 - Core Correctness & Table Management
* **Projection-Correct SELECT**: Column/alias projection with schema validation.
* **Schema-Safe Writes**: INSERT/UPDATE validation with best-effort coercion.
* **Table Management**: SHOW TABLES, DESCRIBE, DROP TABLE (IF EXISTS).
* **Performance Suite**: Integrated benchmark framework for regression testing.
Comment on lines +6 to +48

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix markdown formatting issues flagged by markdownlint.

Multiple headings lack required surrounding blank lines, the table (lines 10-14) needs surrounding blank lines, and there's a trailing space on line 22. These are all flagged by markdownlint (MD022, MD058, MD009). As per coding guidelines, "Check documentation clarity, spelling, grammar, and formatting."

🧰 Tools
🪛 markdownlint-cli2 (0.20.0)

[warning] 6-6: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)


[warning] 6-6: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 9-9: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 10-10: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


[warning] 16-16: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 21-21: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 22-22: Trailing spaces
Expected: 0 or 2; Actual: 1

(MD009, no-trailing-spaces)


[warning] 28-28: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 36-36: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 43-43: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 44-44: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)


[warning] 44-44: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🤖 Prompt for AI Agents
In `@nexum_core/benches/README.md` around lines 6 - 48, The Markdown has lint
issues: ensure every heading (e.g., "## Performance & Benchmarks (Feb 2026)",
"### Comparative Performance Results", "### Analysis", "### Architectural
Insights", "#### 1. Write Throughput: The LSM-Tree Advantage", "#### 2. Read
Latency & AI Overhead", and "## Architecture") is surrounded by a blank line
above and below, add a blank line before and after the table starting with "|
Operation | SQLite | NexumDB | Delta |" and after the table block, and remove
the trailing space on the line in the "Read Latency & AI Overhead" paragraph;
reflow nearby lines so code/inline elements (like `criterion`, `sled`,
`Statement`, `PyO3`) remain properly fenced and the image link ("![Benchmark
Visualization](./nexum_core/benches/bench_results.png)") is also separated by
blank lines.


---

Tests the performance of the underlying storage engine operations:

Expand Down
Binary file added nexum_core/benches/bench_results.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 94 additions & 0 deletions nexum_core/benches/db_comparison.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use rusqlite::Connection;
use tempfile::{NamedTempFile, tempdir};

use nexum_core::storage::StorageEngine;
use nexum_core::executor::Executor;
use nexum_core::sql::parser::Parser;

fn setup_sqlite() -> Connection {
let db_file = NamedTempFile::new().unwrap();
let conn = Connection::open(db_file.path()).unwrap();
conn.execute("CREATE TABLE bench (id INTEGER PRIMARY KEY, val TEXT)", []).unwrap();
conn
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

fn setup_nexum() -> Executor {
let db_path = tempdir().unwrap();
let storage = StorageEngine::new(db_path.path()).unwrap();
let executor = Executor::new(storage);

let sql = "CREATE TABLE bench (id INTEGER, val TEXT)";
// Removed .remove(0) because parse returns a Statement directly
let statement = Parser::parse(sql).unwrap();
executor.execute(statement).unwrap();

executor
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

fn bench_inserts(c: &mut Criterion) {
let mut group = c.benchmark_group("Insert_Performance");

group.bench_function("SQLite_Single_Insert", |b| {
let conn = setup_sqlite();
b.iter(|| {
conn.execute("INSERT INTO bench (val) VALUES ('test_data')", []).unwrap();
});
});

group.bench_function("NexumDB_Single_Insert", |b| {
let executor = setup_nexum();
let sql = "INSERT INTO bench (id, val) VALUES (1, 'test_data')";
let statement = Parser::parse(sql).unwrap();
b.iter(|| {
executor.execute(statement.clone()).unwrap();
});
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

group.finish();
}

fn bench_selects(c: &mut Criterion) {
let mut group = c.benchmark_group("Select_Performance");
let row_count = 1000;

let sqlite_conn = setup_sqlite();
for i in 0..row_count {
sqlite_conn.execute("INSERT INTO bench (id, val) VALUES (?1, 'data')", [i]).unwrap();
}

let nexum_executor = setup_nexum();
let insert_sql = "INSERT INTO bench (id, val) VALUES (1, 'data')";
let insert_stmt = Parser::parse(insert_sql).unwrap();
for _ in 0..row_count {
nexum_executor.execute(insert_stmt.clone()).unwrap();
}

let select_sql = "SELECT val FROM bench WHERE id = 500";
let select_stmt = Parser::parse(select_sql).unwrap();
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

group.bench_function("SQLite_Point_Lookup", |b| {
b.iter(|| {
let mut stmt = sqlite_conn.prepare("SELECT val FROM bench WHERE id = 500").unwrap();
let _ = stmt.query_row([], |r| r.get::<_, String>(0)).unwrap();
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
});

group.bench_function("NexumDB_Point_Lookup_Cold", |b| {
b.iter(|| {
black_box(nexum_executor.execute(select_stmt.clone()).unwrap());
});
});

group.bench_function("NexumDB_Point_Lookup_Cached", |b| {
nexum_executor.execute(select_stmt.clone()).unwrap();
b.iter(|| {
black_box(nexum_executor.execute(select_stmt.clone()).unwrap());
});
});
Comment on lines +67 to +83

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

"Cold" vs "Cached" distinction is meaningless — no semantic cache is enabled.

setup_nexum() creates an Executor without calling .with_cache(), so the semantic caching layer is None. The "cached" benchmark (line 84) merely executes one extra warmup query, but with no cache enabled it behaves identically to the "cold" benchmark. This explains why the PR reports nearly identical timings (1.86ms vs 1.87ms).

Either enable the cache via executor.with_cache() to make the distinction meaningful, or remove the "cold vs cached" split and note that caching is not yet benchmarked.

🤖 Prompt for AI Agents
In `@nexum_core/benches/db_comparison.rs` around lines 77 - 88, The benchmarks
label a "Cold" vs "Cached" run but setup_nexum() constructs an Executor without
enabling the semantic cache, so the "Cached" path (the extra warmup execute on
nexum_executor with select_stmt) has no effect; either enable the cache by
calling with_cache(...) on the Executor returned by setup_nexum() (so that
nexum_executor.with_cache(...) / setup_nexum() config includes the caching
layer) before running the "NexumDB_Point_Lookup_Cached" benchmark, or
remove/rename the cached benchmark and its warmup execute to avoid the
misleading distinction between NexumDB_Point_Lookup_Cold and
NexumDB_Point_Lookup_Cached.


group.finish();
}

criterion_group!(benches, bench_inserts, bench_selects);
criterion_main!(benches);
Comment on lines +88 to +89

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's see the full content of the db_comparison.rs file to understand what benchmarks are defined
cat -n nexum_core/benches/db_comparison.rs

Repository: aviralgarg05/NexumDB

Length of output: 4260


🏁 Script executed:

# Search for INSERT benchmarks in the codebase
rg -rn 'bench_insert\|Insert_Performance\|insert.*bench' --type rust

Repository: aviralgarg05/NexumDB

Length of output: 46


🏁 Script executed:

# Search more broadly for all benchmark files
find nexum_core/benches -type f -name "*.rs"

Repository: aviralgarg05/NexumDB

Length of output: 239


🏁 Script executed:

# Search for any bench_insert, bench_update, bench_delete functions anywhere
rg 'fn bench_insert|fn bench_update|fn bench_delete|fn bench_inserts|fn bench_updates|fn bench_deletes' --type rust

Repository: aviralgarg05/NexumDB

Length of output: 46


🏁 Script executed:

# Check if there are any other benchmark-related files or functions
git ls-files nexum_core/benches/

Repository: aviralgarg05/NexumDB

Length of output: 341


🏁 Script executed:

# Search in all benchmark files for INSERT, UPDATE, DELETE related benchmarks
rg -n 'INSERT|UPDATE|DELETE|insert|update|delete' nexum_core/benches/ --type rust -C 2

Repository: aviralgarg05/NexumDB

Length of output: 8381


🏁 Script executed:

# Check the PR description or issue context - look for references to INSERT, UPDATE, DELETE
cat nexum_core/benches/README.md

Repository: aviralgarg05/NexumDB

Length of output: 8867


🏁 Script executed:

# Check all benchmark files to see what functions they define
for file in nexum_core/benches/*.rs; do 
  echo "=== $file ==="
  grep -n 'fn bench_\|criterion_group!\|criterion_main!' "$file"
done

Repository: aviralgarg05/NexumDB

Length of output: 602


🏁 Script executed:

# Check if there's any reference to PR `#90` or issue context in git commits or files
rg -i 'issue.*90|PR.*90|INSERT.*benchmark|bench.*insert.*UPDATE.*DELETE' --type rust --type md

Repository: aviralgarg05/NexumDB

Length of output: 1265


🏁 Script executed:

# Look at executor_bench.rs more closely to see criterion_group registration
sed -n '289,298p' nexum_core/benches/executor_bench.rs

Repository: aviralgarg05/NexumDB

Length of output: 345


db_comparison.rs lacks comprehensive benchmark coverage. Only SELECT benchmarks are registered; INSERT, UPDATE, and DELETE benchmarks are missing.

The criterion_group! at line 88 registers only bench_selects, yet the README documents INSERT benchmark results comparing SQLite and NexumDB. The file contains INSERT statements used for test data setup (lines 40-50) but no bench_inserts function to measure INSERT performance. Similarly, UPDATE and DELETE benchmarks are absent. Other files (executor_bench.rs, sql_bench.rs) contain INSERT-related benchmarks, but these test SQL parsing and executor behavior, not SQLite comparison as shown in the README.

To align with the documented benchmark results and complete the comparison, add bench_inserts, bench_updates, and bench_deletes functions to this file, register them in the criterion_group, and implement the actual performance comparisons against SQLite.

🤖 Prompt for AI Agents
In `@nexum_core/benches/db_comparison.rs` around lines 88 - 89, Add full CRUD
benchmarks and register them: implement new benchmark functions named
bench_inserts, bench_updates, and bench_deletes (matching the existing
bench_selects pattern) that perform the same operations against NexumDB and
SQLite (use the INSERT statements already in the file for setup as a guide),
measure throughput with Criterion, and ensure each test cleans up or isolates
data between runs; then update the criterion_group! invocation to
criterion_group!(benches, bench_selects, bench_inserts, bench_updates,
bench_deletes) so all four benchmarks are run and comparable to the README
results.

3 changes: 3 additions & 0 deletions nexum_core/benches/storage_bench.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
use std::time::Duration;


use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};

use nexum_core::StorageEngine;



fn storage_write_throughput(c: &mut Criterion) {
Comment on lines 1 to 10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Unnecessary blank lines added.

Lines 3, 8, and 9 introduce extra blank lines that don't improve readability. Consider removing them to keep formatting consistent.

🧹 Remove superfluous blank lines
 use std::time::Duration;
 
-
 use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
 
 use nexum_core::StorageEngine;
 
-
-
 fn storage_write_throughput(c: &mut Criterion) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
use std::time::Duration;
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
use nexum_core::StorageEngine;
fn storage_write_throughput(c: &mut Criterion) {
use std::time::Duration;
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
use nexum_core::StorageEngine;
fn storage_write_throughput(c: &mut Criterion) {
🤖 Prompt for AI Agents
In `@nexum_core/benches/storage_bench.rs` around lines 1 - 10, Remove the
unnecessary blank lines in the imports and before the function declaration in
this file: collapse the extra blank line after "use std::time::Duration;",
remove the blank line(s) between the criterion use block and "use
nexum_core::StorageEngine;", and eliminate the blank line(s) immediately before
the "fn storage_write_throughput(c: &mut Criterion) {" declaration so imports
and the function are grouped consistently.

let mut group = c.benchmark_group("storage_write");

Expand Down
27 changes: 27 additions & 0 deletions nexum_core/benches/visualize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import matplotlib.pyplot as plt
Comment on lines +1 to +6

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove unused sys import.

sys is imported on line 3 but never used anywhere in the file.

♻️ Proposed fix
 import json
 import argparse
-import sys
 from pathlib import Path
 from typing import Dict, List, Optional
 import matplotlib.pyplot as plt
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import json
import argparse
import sys
from pathlib import Path
from typing import Dict, List, Optional
import matplotlib.pyplot as plt
import json
import argparse
from pathlib import Path
from typing import Dict, List, Optional
import matplotlib.pyplot as plt
🤖 Prompt for AI Agents
In `@nexum_core/benches/visualize.py` around lines 1 - 6, Remove the unused sys
import from the top-level imports: delete the reference to sys in the import
block alongside json, argparse, Path, typing, and matplotlib so the file no
longer imports an unused module (ensure only the remaining imports json,
argparse, Path, Dict/List/Optional typing, and matplotlib.pyplot as plt remain).

import numpy as np

# Data from our bench run
labels = ['INSERT', 'SELECT (Cold)', 'SELECT (Cached)']
sqlite_times = [15.18, 0.143, 0.143] # converted to ms
nexum_times = [7.48, 1.86, 1.87] # in ms
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

x = np.arange(len(labels))
width = 0.35

fig, ax = plt.subplots(figsize=(10, 6))
rects1 = ax.bar(x - width/2, sqlite_times, width, label='SQLite', color='#3498db')
rects2 = ax.bar(x + width/2, nexum_times, width, label='NexumDB', color='#e74c3c')

ax.set_ylabel('Latency (ms) - Lower is Better')
ax.set_title('NexumDB vs SQLite Performance Comparison')
ax.set_xticks(x)
ax.set_xticklabels(labels)
ax.legend()

# Log scale helps see the SELECT differences more clearly
ax.set_yscale('log')
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

plt.tight_layout()
plt.savefig('bench_results.png')
print("Chart saved as bench_results.png")
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
Loading
Loading