mirror of
https://github.com/denoland/deno
synced 2024-10-13 19:42:29 +00:00
2338e7679c
This flag was added to evaluate performance relative to tokio's threaded runtime. Although it's faster in the HTTP benchmark, it's clear the runtime is not the only perf problem. Removing this flag will simplify further refactors, in particular adopting the #[tokio::main] macro. This will be done in a follow up. Ultimately we expect to move to the current thread runtime with Isolates pinned to specific threads, but that will be a much larger refactor. The --current-thread just complicates that effort.
18 lines
401 B
Rust
18 lines
401 B
Rust
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
use std::future::Future;
|
|
use tokio;
|
|
use tokio::runtime;
|
|
|
|
pub fn run<F>(future: F)
|
|
where
|
|
F: Future<Output = ()> + Send + 'static,
|
|
{
|
|
let mut rt = runtime::Builder::new()
|
|
.threaded_scheduler()
|
|
.enable_all()
|
|
.thread_name("deno")
|
|
.build()
|
|
.expect("Unable to create Tokio runtime");
|
|
rt.block_on(future);
|
|
}
|