diff --git a/perf/throughput/rusqlite/scripts/bench.sh b/perf/throughput/rusqlite/scripts/bench.sh new file mode 100755 index 000000000..a4efcc6e5 --- /dev/null +++ b/perf/throughput/rusqlite/scripts/bench.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +cargo build --release + +echo "system,threads,batch_size,compute,throughput" + +for threads in 1 2 4 8; do + for compute in 0 100 500 1000; do + ../../../target/release/write-throughput-sqlite --threads ${threads} --batch-size 100 --compute ${compute} -i 1000 + done +done diff --git a/perf/throughput/rusqlite/src/main.rs b/perf/throughput/rusqlite/src/main.rs index af54b8818..c926f2a44 100644 --- a/perf/throughput/rusqlite/src/main.rs +++ b/perf/throughput/rusqlite/src/main.rs @@ -28,11 +28,6 @@ struct Args { fn main() -> Result<()> { let args = Args::parse(); - println!( - "Running write throughput benchmark with {} threads, {} batch size, {} iterations", - args.threads, args.batch_size, args.iterations - ); - let db_path = "write_throughput_test.db"; if std::path::Path::new(db_path).exists() { std::fs::remove_file(db_path).expect("Failed to remove existing database"); @@ -86,17 +81,9 @@ fn main() -> Result<()> { let overall_elapsed = overall_start.elapsed(); let overall_throughput = (total_inserts as f64) / overall_elapsed.as_secs_f64(); - println!("\n=== BENCHMARK RESULTS ==="); - println!("Total inserts: {total_inserts}",); - println!("Total time: {:.2}s", overall_elapsed.as_secs_f64()); - println!("Overall throughput: {overall_throughput:.2} inserts/sec"); - println!("Threads: {}", args.threads); - println!("Batch size: {}", args.batch_size); - println!("Iterations per thread: {}", args.iterations); - println!( - "Database file exists: {}", - std::path::Path::new(db_path).exists() + "SQLite,{},{},{},{:.2}", + args.threads, args.batch_size, args.compute, overall_throughput ); Ok(()) @@ -116,7 +103,6 @@ fn setup_database(db_path: &str) -> Result { [], )?; - println!("Database created at: {db_path}"); Ok(conn) } @@ -134,7 +120,6 @@ fn worker_thread( start_barrier.wait(); - let start_time = Instant::now(); let mut total_inserts = 0; for iteration in 0..iterations { @@ -155,17 +140,6 @@ fn worker_thread( conn.execute("COMMIT", [])?; } - let elapsed = start_time.elapsed(); - let throughput = (total_inserts as f64) / elapsed.as_secs_f64(); - - println!( - "Thread {}: {} inserts in {:.2}s ({:.2} inserts/sec)", - thread_id, - total_inserts, - elapsed.as_secs_f64(), - throughput - ); - Ok(total_inserts) } diff --git a/perf/throughput/turso/scripts/bench.sh b/perf/throughput/turso/scripts/bench.sh new file mode 100755 index 000000000..6d6f75d4b --- /dev/null +++ b/perf/throughput/turso/scripts/bench.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +cargo build --release + +echo "system,threads,batch_size,compute,throughput" + +for threads in 1 2 4 8; do + for compute in 0 100 500 1000; do + ../../../target/release/write-throughput --threads ${threads} --batch-size 100 --compute ${compute} -i 1000 --mode concurrent + done +done diff --git a/perf/throughput/turso/src/main.rs b/perf/throughput/turso/src/main.rs index 745b392d1..8e9f13c77 100644 --- a/perf/throughput/turso/src/main.rs +++ b/perf/throughput/turso/src/main.rs @@ -61,11 +61,6 @@ async fn main() -> Result<()> { .init(); let args = Args::parse(); - println!( - "Running write throughput benchmark with {} threads, {} batch size, {} iterations, mode: {:?}", - args.threads, args.batch_size, args.iterations, args.mode - ); - let db_path = "write_throughput_test.db"; if std::path::Path::new(db_path).exists() { std::fs::remove_file(db_path).expect("Failed to remove existing database"); @@ -120,21 +115,10 @@ async fn main() -> Result<()> { let overall_elapsed = overall_start.elapsed(); let overall_throughput = (total_inserts as f64) / overall_elapsed.as_secs_f64(); - println!("\n=== BENCHMARK RESULTS ==="); - println!("Total inserts: {total_inserts}"); - println!("Total time: {:.2}s", overall_elapsed.as_secs_f64()); - println!("Overall throughput: {overall_throughput:.2} inserts/sec"); - println!("Threads: {}", args.threads); - println!("Batch size: {}", args.batch_size); - println!("Iterations per thread: {}", args.iterations); - println!( - "Database file exists: {}", - std::path::Path::new(db_path).exists() + "Turso,{},{},{},{:.2}", + args.threads, args.batch_size, args.compute, overall_throughput ); - if let Ok(metadata) = std::fs::metadata(db_path) { - println!("Database file size: {} bytes", metadata.len()); - } Ok(()) } @@ -187,7 +171,6 @@ async fn worker_thread( ) -> Result { start_barrier.wait(); - let start_time = Instant::now(); let total_inserts = Arc::new(AtomicU64::new(0)); let mut tx_futs = vec![]; @@ -234,17 +217,7 @@ async fn worker_thread( result?; } - let elapsed = start_time.elapsed(); let final_inserts = total_inserts.load(Ordering::Relaxed); - let throughput = (final_inserts as f64) / elapsed.as_secs_f64(); - - println!( - "Thread {}: {} inserts in {:.2}s ({:.2} inserts/sec)", - thread_id, - final_inserts, - elapsed.as_secs_f64(), - throughput - ); Ok(final_inserts) }