nushell/crates/nu-utils/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
..
sample_config Bump version to 0.92.3 (#12476) 2024-04-12 08:00:43 -05:00
casing.rs Improve case insensitivity consistency (#10884) 2023-11-08 23:58:54 +01:00
ctrl_c.rs Add helper method to check whether ctrl+c was pressed, adopt it (#7482) 2022-12-15 09:39:24 -08:00
deansi.rs update strip-ansi-escapes to use new api (#9958) 2023-08-08 15:20:37 -05:00
emoji.rs add special emoji handling for debug --raw (#11368) 2023-12-19 13:09:31 -06:00
filesystem.rs Make auto-cd check for permissions (#12342) 2024-04-06 08:56:46 -05:00
lib.rs Copy-on-write for record values (#12305) 2024-04-14 01:42:03 +00:00
locale.rs Reduce again the number of match calls (#7815) 2023-01-24 12:23:42 +01:00
main.rs added nu-utils crate, fixed issue where externals turn off vt processing (#4857) 2022-03-16 17:21:06 -05:00
shared_cow.rs Copy-on-write for record values (#12305) 2024-04-14 01:42:03 +00:00
utils.rs break the definition of LS_COLORS onto multiple lines (#10538) 2023-09-29 19:12:46 +02:00