From 75144e21ee94c11e54a5fb1f521a9a814b1faacc Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Mon, 16 Jun 2025 15:46:46 -0400 Subject: [PATCH] Parallelize individual table reads/writes for modest gains. --- src/test.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/test.rs b/src/test.rs index c757168..fb0ea22 100644 --- a/src/test.rs +++ b/src/test.rs @@ -34,10 +34,20 @@ async fn test_mysql() -> Result<(), Error> { let pool = TestPool::try_new().await?; crate::load_data(&pool).await?; time_test::time_test!(); - crate::convert_data(&pool, "employees").await?; - crate::convert_data(&pool, "departments").await?; - ::clone(&pool) - .disconnect() - .await?; + let tables = vec!["employees", "departments"]; + let mut handles: Vec>> = vec![]; + for table in tables { + handles.push(tokio::spawn({ + let pool = pool.clone(); + let table = table.to_string(); + async move { + crate::convert_data(&pool, &table).await?; + Ok(()) + } + })); + } + for handle in handles { + let _ = handle.await?; + } Ok(()) }