Remove engine_state clones in REPL eval (#7713)

A small but easy optimization for `evaluate_repl()`: clone
`engine_state` 1x instead of 3x.

This reduces time spent in a simple REPL eval (`enter` key pressed with
no command text) by about 10%, as measured in
[Superluminal](https://superluminal.eu/).
This commit is contained in:
Reilly Wood
2023-01-10 17:22:32 -08:00
committed by GitHub
parent 9a56665c6b
commit 5664ee7bda
4 changed files with 7 additions and 5 deletions

View File

@ -1,9 +1,10 @@
use nu_parser::{parse, ParseError};
use nu_protocol::engine::{EngineState, StateWorkingSet};
use reedline::{ValidationResult, Validator};
use std::sync::Arc;
pub struct NuValidator {
pub engine_state: EngineState,
pub engine_state: Arc<EngineState>,
}
impl Validator for NuValidator {