nushell/crates/nu-cmd-extra
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
..
assets REFACTOR: move the 0% commands to nu-cmd-extra (#9404) 2023-07-06 08:31:31 -07:00
src Copy-on-write for record values (#12305) 2024-04-14 01:42:03 +00:00
tests Remove feat extra and include in default (#12140) 2024-03-10 17:29:02 +01:00
Cargo.toml Bump version to 0.92.3 (#12476) 2024-04-12 08:00:43 -05:00
LICENSE nu-cmd-extra crate infrastructure in place with the Bits command as the model for adding other commands (#9327) 2023-06-01 10:46:16 -07:00
README.md Remove feat extra and include in default (#12140) 2024-03-10 17:29:02 +01:00

nu-cmd-extra

The commands in this crate are the extra commands of Nushell. These commands are not in a state to be guaranteed to be part of the 1.0 API; meaning that there is no guarantee longer term that these commands will be around into the future.

For a while we did exclude them behind the --features extra compile time flag, meaning that the default release did not contain them. As we (the Nushell team) shipped a full build including both extra and dataframe for some time, we chose to sunset the extra feature but keep the commands in this crate for now. In the future the commands may be moved to more topical crates or discarded into plugins.