mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-09 18:24:20 +01:00
perf/throughput: Simplify benchmark output to CSV format
Remove verbose output from rusqlite benchmark and output only CSV format: system,threads,batch_size,compute,throughput This makes it easier to parse and plot benchmark results.
This commit is contained in:
11
perf/throughput/rusqlite/scripts/bench.sh
Executable file
11
perf/throughput/rusqlite/scripts/bench.sh
Executable file
@@ -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
|
||||
@@ -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<Connection> {
|
||||
[],
|
||||
)?;
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
11
perf/throughput/turso/scripts/bench.sh
Executable file
11
perf/throughput/turso/scripts/bench.sh
Executable file
@@ -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
|
||||
@@ -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<u64> {
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user