mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 08:23:24 +01:00
Remove -t
/--threads
flag from nu (#8686)
### What?
This PR removes the `--threads` flag from nu.exe:
![image](https://user-images.githubusercontent.com/26268125/229021408-bf78ce64-11f7-4354-a410-ed905b96bb5a.png)
### Why?
Darren added a `--threads` flag to `par-each` in
https://github.com/nushell/nushell/pull/8679, so it no longer respects
the global `--threads` flag. Now the only place `rayon` is used is [the
`table`
renderer](3db0aed9f7/crates/nu-command/src/viewers/table.rs (L15)
).
I don't think anyone will actually want to specify the number of threads
used in `table`, and it would be confusing to leave this flag around
when it no longer does anything useful.
### Notes
Relevant `rayon` docs:
https://docs.rs/rayon/latest/rayon/struct.ThreadPoolBuilder.html#method.build_global
This commit is contained in:
parent
83ddf0ebe2
commit
678e942bd8
@ -107,7 +107,6 @@ pub(crate) fn parse_commandline_args(
|
|||||||
let log_level: Option<Expression> = call.get_flag_expr("log-level");
|
let log_level: Option<Expression> = call.get_flag_expr("log-level");
|
||||||
let log_target: Option<Expression> = call.get_flag_expr("log-target");
|
let log_target: Option<Expression> = call.get_flag_expr("log-target");
|
||||||
let execute: Option<Expression> = call.get_flag_expr("execute");
|
let execute: Option<Expression> = call.get_flag_expr("execute");
|
||||||
let threads: Option<Value> = call.get_flag(engine_state, &mut stack, "threads")?;
|
|
||||||
let table_mode: Option<Value> =
|
let table_mode: Option<Value> =
|
||||||
call.get_flag(engine_state, &mut stack, "table-mode")?;
|
call.get_flag(engine_state, &mut stack, "table-mode")?;
|
||||||
|
|
||||||
@ -181,7 +180,6 @@ pub(crate) fn parse_commandline_args(
|
|||||||
log_level,
|
log_level,
|
||||||
log_target,
|
log_target,
|
||||||
execute,
|
execute,
|
||||||
threads,
|
|
||||||
table_mode,
|
table_mode,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -213,7 +211,6 @@ pub(crate) struct NushellCliArgs {
|
|||||||
pub(crate) log_level: Option<Spanned<String>>,
|
pub(crate) log_level: Option<Spanned<String>>,
|
||||||
pub(crate) log_target: Option<Spanned<String>>,
|
pub(crate) log_target: Option<Spanned<String>>,
|
||||||
pub(crate) execute: Option<Spanned<String>>,
|
pub(crate) execute: Option<Spanned<String>>,
|
||||||
pub(crate) threads: Option<Value>,
|
|
||||||
pub(crate) table_mode: Option<Value>,
|
pub(crate) table_mode: Option<Value>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
src/main.rs
18
src/main.rs
@ -136,24 +136,6 @@ fn main() -> Result<()> {
|
|||||||
use_color,
|
use_color,
|
||||||
);
|
);
|
||||||
|
|
||||||
start_time = std::time::Instant::now();
|
|
||||||
if let Some(t) = parsed_nu_cli_args.threads.clone() {
|
|
||||||
// 0 means to let rayon decide how many threads to use
|
|
||||||
let threads = t.as_i64().unwrap_or(0);
|
|
||||||
rayon::ThreadPoolBuilder::new()
|
|
||||||
.num_threads(threads as usize)
|
|
||||||
.build_global()
|
|
||||||
.expect("error setting number of threads");
|
|
||||||
}
|
|
||||||
perf(
|
|
||||||
"set rayon threads",
|
|
||||||
start_time,
|
|
||||||
file!(),
|
|
||||||
line!(),
|
|
||||||
column!(),
|
|
||||||
use_color,
|
|
||||||
);
|
|
||||||
|
|
||||||
start_time = std::time::Instant::now();
|
start_time = std::time::Instant::now();
|
||||||
if let Some(testbin) = &parsed_nu_cli_args.testbin {
|
if let Some(testbin) = &parsed_nu_cli_args.testbin {
|
||||||
// Call out to the correct testbin
|
// Call out to the correct testbin
|
||||||
|
Loading…
Reference in New Issue
Block a user