add perf/throughput/turso to workspace

This commit is contained in:
pedrocarlo
2025-09-12 12:13:13 -03:00
parent bc4aa63203
commit 01a99f84a6
5 changed files with 20 additions and 2075 deletions

10
Cargo.lock generated
View File

@@ -5009,6 +5009,16 @@ dependencies = [
"bitflags 2.9.0",
]
[[package]]
name = "write-throughput"
version = "0.1.0"
dependencies = [
"clap",
"futures",
"tokio",
"turso",
]
[[package]]
name = "write16"
version = "1.0.0"

View File

@@ -30,11 +30,11 @@ members = [
"sync/engine",
"sql_generation",
"whopper",
"perf/throughput/turso"
]
exclude = [
"perf/latency/limbo",
"perf/throughput/rusqlite",
"perf/throughput/turso"
]
[workspace.package]
@@ -75,6 +75,7 @@ tracing = "0.1.41"
schemars = "1.0.4"
garde = "0.22"
parking_lot = "0.12.4"
tokio = { version = "1.0", default-features = false }
[profile.release]
debug = "line-tables-only"

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@ name = "write-throughput"
path = "src/main.rs"
[dependencies]
turso = { path = "../../../bindings/rust" }
turso = { workspace = true }
clap = { version = "4.0", features = ["derive"] }
tokio = { version = "1.0", features = ["full"] }
tokio = { workspace = true, default-features = true, features = ["full"] }
futures = "0.3"

View File

@@ -1,6 +1,6 @@
use clap::{Parser, ValueEnum};
use std::sync::{Arc, Barrier};
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::{Arc, Barrier};
use std::time::Instant;
use turso::{Builder, Database, Result};
@@ -82,7 +82,7 @@ async fn main() -> Result<()> {
match handle.await {
Ok(Ok(inserts)) => total_inserts += inserts,
Ok(Err(e)) => {
eprintln!("Thread error: {}", e);
eprintln!("Thread error: {e}");
return Err(e);
}
Err(_) => {
@@ -96,9 +96,9 @@ async fn main() -> Result<()> {
let overall_throughput = (total_inserts as f64) / overall_elapsed.as_secs_f64();
println!("\n=== BENCHMARK RESULTS ===");
println!("Total inserts: {}", total_inserts);
println!("Total inserts: {total_inserts}");
println!("Total time: {:.2}s", overall_elapsed.as_secs_f64());
println!("Overall throughput: {:.2} inserts/sec", overall_throughput);
println!("Overall throughput: {overall_throughput:.2} inserts/sec");
println!("Threads: {}", args.threads);
println!("Batch size: {}", args.batch_size);
println!("Iterations per thread: {}", args.iterations);
@@ -133,7 +133,7 @@ async fn setup_database(db_path: &str, mode: TransactionMode) -> Result<Database
)
.await?;
println!("Database created at: {}", db_path);
println!("Database created at: {db_path}");
Ok(db)
}
@@ -171,7 +171,7 @@ async fn worker_thread(
let id = thread_id * iterations * batch_size + iteration * batch_size + i;
stmt.execute(turso::params::Params::Positional(vec![
turso::Value::Integer(id as i64),
turso::Value::Text(format!("data_{}", id)),
turso::Value::Text(format!("data_{id}")),
]))
.await?;
total_inserts.fetch_add(1, Ordering::Relaxed);