perf/throughput: Fix thread pool size in Turso benchmark

Replace #[tokio::main] with explicit Runtime builder to set the number
of tokio worker threads to match the benchmark thread count. This
ensures proper thread control and avoids interference from default
tokio thread pool sizing.
This commit is contained in:
Pekka Enberg
2025-10-01 10:18:43 +03:00
parent 63895dfecd
commit 3fcb0581ec

View File

@@ -52,8 +52,7 @@ struct Args {
io: Option<IoOption>,
}
#[tokio::main]
async fn main() -> Result<()> {
fn main() -> Result<()> {
tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env())
.with_ansi(false)
@@ -61,6 +60,15 @@ async fn main() -> Result<()> {
.init();
let args = Args::parse();
let rt = tokio::runtime::Builder::new_multi_thread()
.worker_threads(args.threads)
.build()
.unwrap();
rt.block_on(async_main(args))
}
async fn async_main(args: Args) -> Result<()> {
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");