0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

Remove --current-thread flag (#3830)

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.
This commit is contained in:
Ryan Dahl 2020-01-30 10:49:33 -05:00 committed by GitHub
parent 51089836eb
commit 2338e7679c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 1 additions and 64 deletions

View file

@ -85,8 +85,6 @@ pub struct DenoFlags {
pub cached_only: bool,
pub seed: Option<u64>,
pub v8_flags: Option<Vec<String>>,
// Use tokio::runtime::current_thread
pub current_thread: bool,
pub bundle_output: Option<String>,
@ -438,10 +436,6 @@ fn run_test_args_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) {
flags.cached_only = true;
}
if matches.is_present("current-thread") {
flags.current_thread = true;
}
if matches.is_present("seed") {
let seed_string = matches.value_of("seed").unwrap();
let seed = seed_string.parse::<u64>().unwrap();
@ -754,11 +748,6 @@ fn run_test_args<'a, 'b>(app: App<'a, 'b>) -> App<'a, 'b> {
.long("cached-only")
.help("Require that remote dependencies are already cached"),
)
.arg(
Arg::with_name("current-thread")
.long("current-thread")
.help("Use tokio::runtime::current_thread"),
)
.arg(
Arg::with_name("seed")
.long("seed")
@ -1873,20 +1862,6 @@ mod tests {
);
}
#[test]
fn current_thread() {
let r = flags_from_vec_safe(svec!["deno", "--current-thread", "script.ts"]);
assert_eq!(
r.unwrap(),
DenoFlags {
subcommand: DenoSubcommand::Run,
argv: svec!["deno", "script.ts"],
current_thread: true,
..DenoFlags::default()
}
);
}
#[test]
fn allow_net_whitelist_with_ports() {
let r = flags_from_vec_safe(svec![

View file

@ -378,7 +378,6 @@ fn run_repl(flags: DenoFlags) {
}
fn run_script(flags: DenoFlags) {
let use_current_thread = flags.current_thread;
let (mut worker, state) = create_worker_and_state(flags);
let maybe_main_module = state.main_module.as_ref();
@ -416,11 +415,7 @@ fn run_script(flags: DenoFlags) {
js_check(worker_.execute("window.dispatchEvent(new Event('unload'))"));
};
if use_current_thread {
tokio_util::run_on_current_thread(main_future);
} else {
tokio_util::run(main_future);
}
tokio_util::run(main_future);
}
fn format_command(files: Option<Vec<String>>, check: bool) {

View file

@ -320,11 +320,6 @@ itest!(_036_import_map_fetch {
output: "036_import_map_fetch.out",
});
itest!(_037_current_thread {
args: "run --current-thread --reload 034_onload/main.ts",
output: "034_onload.out",
});
itest!(_038_checkjs {
// checking if JS file is run through TS compiler
args: "run --reload --config 038_checkjs.tsconfig.json 038_checkjs.js",

View file

@ -15,16 +15,3 @@ where
.expect("Unable to create Tokio runtime");
rt.block_on(future);
}
pub fn run_on_current_thread<F>(future: F)
where
F: Future<Output = ()> + Send + 'static,
{
let mut rt = runtime::Builder::new()
.basic_scheduler()
.enable_all()
.thread_name("deno")
.build()
.expect("Unable to create Tokio runtime");
rt.block_on(future);
}

View file

@ -1267,9 +1267,6 @@ Useful V8 flags during profiling:
- --log-source-code
- --track-gc-object-stats
Note that you might need to run Deno with `--current-thread` flag to capture
full V8 profiling output.
To learn more about `d8` and profiling, check out the following links:
- [https://v8.dev/docs/d8](https://v8.dev/docs/d8)

View file

@ -42,17 +42,6 @@ def deno_tcp(deno_exe):
return run(deno_cmd, port)
def deno_tcp_current_thread(deno_exe):
port = get_port()
deno_cmd = [
deno_exe, "run", "--current-thread", "--allow-net",
"tools/deno_tcp.ts",
server_addr(port)
]
print "http_benchmark testing DENO tcp (single-thread)."
return run(deno_cmd, port)
def deno_http(deno_exe):
port = get_port()
deno_cmd = [
@ -154,7 +143,6 @@ def http_benchmark(build_dir):
return {
# "deno_tcp" was once called "deno"
"deno_tcp": deno_tcp(deno_exe),
"deno_tcp_current_thread": deno_tcp_current_thread(deno_exe),
# "deno_http" was once called "deno_net_http"
"deno_http": deno_http(deno_exe),
"deno_proxy": deno_http_proxy(deno_exe, hyper_hello_exe),