nushell/crates/nu-plugin/src/plugin
Devyn Cairns 0e36c43c64
Add BufWriter to ChildStdin on the plugin interface (#12419)
# Description
This speeds up writing messages to the plugin, because otherwise every
individual piece of the messages (not even the entire message) is
written with one syscall, leading to a lot of back and forth with the
kernel.

I learned this by running `strace` to debug something and saw a ton of
`write()` calls.

```nushell
# Before
1..10 | each { timeit { example seq 1 10000 | example sum } } | math avg
269ms 779µs 149ns
# After
> 1..10 | each { timeit { example seq 1 10000 | example sum } } | math avg
39ms 636µs 643ns
```

# User-Facing Changes
- Performance improvement

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`
2024-04-06 11:52:27 +08:00
..
interface Improve handling of custom values in plugin examples (#12409) 2024-04-05 21:57:20 -05:00
command.rs Improve handling of custom values in plugin examples (#12409) 2024-04-05 21:57:20 -05:00
context.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
declaration.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
gc.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
interface.rs Make drop notification timing for plugin custom values more consistent (#12341) 2024-04-04 09:13:25 +02:00
mod.rs Add BufWriter to ChildStdin on the plugin interface (#12419) 2024-04-06 11:52:27 +08:00
persistent.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
source.rs Improve handling of custom values in plugin examples (#12409) 2024-04-05 21:57:20 -05:00