nushell/crates/nu-cli/src
Devyn Cairns 2ae9ad8676
Copy-on-write for record values (#12305)
# 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`
2024-04-14 01:42:03 +00:00
..
commands fix simple typo in commandline_.rs (#12387) 2024-04-04 09:59:52 +02:00
completions Copy-on-write for record values (#12305) 2024-04-14 01:42:03 +00:00
menus Rename IoStream to OutDest (#12433) 2024-04-09 16:48:32 +00:00
config_files.rs better logging for shell_integration ansi escapes + better plugin perf logging (#12494) 2024-04-12 10:11:41 -05:00
eval_cmds.rs Add --no-newline option to nu (#12410) 2024-04-09 10:04:00 -04:00
eval_file.rs Add --no-newline option to nu (#12410) 2024-04-09 10:04:00 -04:00
lib.rs Send LSP Completion Item Kind (#11443) 2024-03-24 20:14:12 -05:00
nu_highlight.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
print.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
prompt.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
prompt_update.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
reedline_config.rs add a few more logging statements for debugging startup (#12316) 2024-03-28 11:27:12 -05:00
repl.rs better logging for shell_integration ansi escapes + better plugin perf logging (#12494) 2024-04-12 10:11:41 -05:00
syntax_highlight.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
util.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
validation.rs Remove old alias implementation (#8797) 2023-04-07 21:09:38 +03:00