Skip to content

Commit 0bf9b63

Browse files
authored
perf(async): improve async io (#18)
1 parent c499b94 commit 0bf9b63

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.changes/async.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eval-stack": patch:perf
3+
---
4+
5+
Improve the performance of the async I/O operations.

src/case.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use std::{fs::create_dir_all, path::PathBuf, time::Duration};
1+
use std::{path::PathBuf, time::Duration};
22

33
use anyhow::Result;
4+
use tokio::fs::{create_dir_all, remove_dir_all};
45
use which::which;
56

67
use crate::{
@@ -25,7 +26,7 @@ where
2526
let workspace: PathBuf = workspace.into();
2627

2728
if !workspace.exists() {
28-
create_dir_all(&workspace)?;
29+
create_dir_all(&workspace).await?;
2930
}
3031

3132
let source_file_path = Into::<PathBuf>::into(source_file_path)
@@ -97,7 +98,7 @@ where
9798
}
9899

99100
if clean {
100-
if let Err(e) = std::fs::remove_dir_all(workspace) {
101+
if let Err(e) = remove_dir_all(workspace).await {
101102
anyhow::bail!("Failed to remove workspace: {}", e);
102103
}
103104
}

src/engine/runtime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub async fn handle_submission(
9898
submission
9999
.test_cases
100100
.into_iter()
101-
.map(|_tc| ("tests/1.in", "tests/1.out"))
101+
.map(|tc| (tc.input, tc.output))
102102
.collect(),
103103
true,
104104
)

0 commit comments

Comments
 (0)