mirror of
https://github.com/nushell/nushell.git
synced 2025-05-01 16:44:27 +02:00
# Description This adds a `SharedCow` type as a transparent copy-on-write pointer that clones to unique on mutate. As an initial test, the `Record` within `Value::Record` is shared. There are some pretty big wins for performance. I'll post benchmark results in a comment. The biggest winner is nested access, as that would have cloned the records for each cell path follow before and it doesn't have to anymore. The reusability of the `SharedCow` type is nice and I think it could be used to clean up the previous work I did with `Arc` in `EngineState`. It's meant to be a mostly transparent clone-on-write that just clones on `.to_mut()` or `.into_owned()` if there are actually multiple references, but avoids cloning if the reference is unique. # User-Facing Changes - `Value::Record` field is a different type (plugin authors) # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting - [ ] use for `EngineState` - [ ] use for `Value::List`
25 lines
570 B
Rust
25 lines
570 B
Rust
mod casing;
|
|
pub mod ctrl_c;
|
|
mod deansi;
|
|
pub mod emoji;
|
|
pub mod filesystem;
|
|
pub mod locale;
|
|
mod shared_cow;
|
|
pub mod utils;
|
|
|
|
pub use locale::get_system_locale;
|
|
pub use utils::{
|
|
enable_vt_processing, get_default_config, get_default_env, get_ls_colors,
|
|
stderr_write_all_and_flush, stdout_write_all_and_flush,
|
|
};
|
|
|
|
pub use casing::IgnoreCaseExt;
|
|
pub use deansi::{
|
|
strip_ansi_likely, strip_ansi_string_likely, strip_ansi_string_unlikely, strip_ansi_unlikely,
|
|
};
|
|
pub use emoji::contains_emoji;
|
|
pub use shared_cow::SharedCow;
|
|
|
|
#[cfg(unix)]
|
|
pub use filesystem::users;
|