mirror of
https://github.com/denoland/deno.git
synced 2024-11-01 09:24:20 -04:00
09ae512ccb
This commit adds "deno bench" subcommand and "Deno.bench()" API that allows to register bench cases. The API is modelled after "Deno.test()" and "deno test" subcommand. Currently the output is rudimentary and bench cases and not subject to "ops" and "resource" sanitizers. Co-authored-by: evan <github@evan.lol>
30 lines
624 B
Rust
30 lines
624 B
Rust
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
|
|
|
use crate::proc_state::ProcState;
|
|
use deno_core::Extension;
|
|
|
|
pub mod bench;
|
|
mod errors;
|
|
mod runtime_compiler;
|
|
pub mod testing;
|
|
|
|
pub fn cli_exts(ps: ProcState, enable_compiler: bool) -> Vec<Extension> {
|
|
if enable_compiler {
|
|
vec![
|
|
init_proc_state(ps),
|
|
errors::init(),
|
|
runtime_compiler::init(),
|
|
]
|
|
} else {
|
|
vec![init_proc_state(ps), errors::init()]
|
|
}
|
|
}
|
|
|
|
fn init_proc_state(ps: ProcState) -> Extension {
|
|
Extension::builder()
|
|
.state(move |state| {
|
|
state.put(ps.clone());
|
|
Ok(())
|
|
})
|
|
.build()
|
|
}
|