Skip to content

Commit

Permalink
perf(cli): force terminal_links to reduce sys calls
Browse files Browse the repository at this point in the history
terminal_links has auto detection on by default,
it will get repeatedly called from parser rewind
with a `is_atty` system call.

closes #906
  • Loading branch information
Boshen committed Sep 14, 2023
1 parent dd74d93 commit becd7d8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/oxc_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
use oxc_cli::{CliCommand, CliRunResult, LintRunner, Runner, TypeCheckRunner};

fn main() -> CliRunResult {
miette::set_hook(Box::new(|_| {
Box::new(
miette::MietteHandlerOpts::new()
// Force the value to disable auto detection, which is an
// expensive syscall when called repeatly

Check warning on line 18 in crates/oxc_cli/src/main.rs

View workflow job for this annotation

GitHub Actions / Spell Check

"repeatly" should be "repeatedly".
.terminal_links(true)
.build(),
)
}))
.unwrap();

let options = oxc_cli::cli_command().fallback_to_usage().run();
options.handle_threads();
match options {
Expand Down

0 comments on commit becd7d8

Please sign in to comment.