Skip to content

Commit 725c6c6

Browse files
authored
Simpler tokio runtime (#140)
* Simpler tokio runtime; 3 threads and no io driver * switch benches over to other runtime
1 parent fca61d5 commit 725c6c6

3 files changed

Lines changed: 20 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Unreleased
22

3+
- Added windows support! (thank you to [@jarjk](https://github.com/jarjk) for helping out!)
34
- Added keybindings (`0`/`$`) to scroll to left or right side of zoomed-in image ([#131](https://github.com/itsjunetime/tdf/pull/131), thank you [@IshDeshpa](https://github.com/IshDeshpa)!)
5+
- (Internal) decreased runtime footprint of tokio runtime
46

57
# v0.5.0
68

benches/rendering.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ fn for_all_combos(
3434
name: &'static str,
3535
mut f: impl FnMut(&Runtime, BenchmarkId, &'static str, ProtocolType)
3636
) {
37-
let rt = tokio::runtime::Runtime::new().unwrap();
37+
let rt = tokio::runtime::Builder::new_multi_thread()
38+
.worker_threads(3)
39+
.enable_time()
40+
.build()
41+
.unwrap();
42+
3843
for proto in PROTOS {
3944
for file in FILES {
4045
f(

src/main.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,18 @@ fn reset_term() {
7070
);
7171
}
7272

73-
#[tokio::main]
74-
async fn main() -> Result<(), WrappedErr> {
75-
let result = inner_main().await;
76-
reset_term();
77-
result
73+
fn main() -> Result<(), WrappedErr> {
74+
let rt = tokio::runtime::Builder::new_multi_thread()
75+
.worker_threads(3)
76+
.enable_time()
77+
.build()
78+
.unwrap();
79+
80+
rt.block_on(async move {
81+
let result = inner_main().await;
82+
reset_term();
83+
result
84+
})
7885
}
7986

8087
async fn inner_main() -> Result<(), WrappedErr> {

0 commit comments

Comments
 (0)