nushell/crates
Devyn Cairns ad6deadf24
Flush on every plugin Data message (#12728)
# Description

This helps to ensure data produced on a stream is immediately available
to the consumer of the stream. The BufWriter introduced for performance
reasons in 0.93 exposed the behavior that data messages wouldn't make it
to the other side until they filled the buffer in @cablehead's
[`nu_plugin_from_sse`](https://github.com/cablehead/nu_plugin_from_sse).

I had originally not flushed on every `Data` message because I figured
that it isn't really critical that the other side sees those messages
immediately, since they're not used for control and they are flushed
when waiting for acknowledgement or when the buffer is too full anyway.

Increasing the amount of data that can be sent with a single underlying
write increases performance, but this interferes with some plugins that
want to use streams in a more real-time way. In the future I would like
to make this configurable, maybe even per-command, so that a command can
decide what the priority is. But for now I think this is reasonable.

In the worst case, this decreases performance by about 40%, when sending
very small values (just numbers). But for larger values, this PR
actually increases performance by about 20%, because I've increased the
buffer size about 2x to 16,384 bytes. The previous value of 8,192 bytes
was too small to fit a full buffer coming from an external command, so
doubling it makes sense, and now a write of a buffer from an external
command can be done in exactly one write call, which I think makes
sense. I'm doing this at the same time because flushing each data
message would make it very likely that each individual data message from
an external stream would require exactly two writes rather than
approximately one (amortized).

Again, hopefully the tradeoff isn't too bad, and if it is I'll just make
it configurable.

# User-Facing Changes

- Performance of plugin streams will be a bit different
- Plugins that expect to send streams in real-time will work again

# Tests + Formatting

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`
2024-05-02 23:51:16 +00:00
..
nu-cli overhaul shell_integration to enable individual control over ansi escape sequences (#12629) 2024-05-02 09:56:50 -04:00
nu-cmd-base Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-cmd-dataframe Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-cmd-extra Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-cmd-lang Rework for new clippy lints (#12736) 2024-05-02 19:29:03 +02:00
nu-cmd-plugin Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-color-config add raw-string literal support (#9956) 2024-05-02 09:36:37 -04:00
nu-command Rework for new clippy lints (#12736) 2024-05-02 19:29:03 +02:00
nu-engine Change environment variables to be case-preserving (#12701) 2024-05-01 17:22:34 -05:00
nu-explore explore: adopt anyhow, support CustomValue, remove help system (#12692) 2024-05-01 17:34:37 -05:00
nu-glob Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-json Rework for new clippy lints (#12736) 2024-05-02 19:29:03 +02:00
nu-lsp Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-parser add raw-string literal support (#9956) 2024-05-02 09:36:37 -04:00
nu-path Path expansion no longer removes trailing slashes (#12662) 2024-05-01 17:28:54 -05:00
nu-plugin Flush on every plugin Data message (#12728) 2024-05-02 23:51:16 +00:00
nu-plugin-core Flush on every plugin Data message (#12728) 2024-05-02 23:51:16 +00:00
nu-plugin-engine Flush on every plugin Data message (#12728) 2024-05-02 23:51:16 +00:00
nu-plugin-protocol Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-plugin-test-support Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-pretty-hex Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-protocol Rework for new clippy lints (#12736) 2024-05-02 19:29:03 +02:00
nu-std Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-system Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-table Rework for new clippy lints (#12736) 2024-05-02 19:29:03 +02:00
nu-term-grid Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-test-support Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-utils overhaul shell_integration to enable individual control over ansi escape sequences (#12629) 2024-05-02 09:56:50 -04:00
nu_plugin_custom_values Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu_plugin_example Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu_plugin_formats Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu_plugin_gstat Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu_plugin_inc Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu_plugin_nu_example Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu_plugin_polars Fix clippy::wrong_self_convention in polars plugin (#12737) 2024-05-02 19:31:51 +02:00
nu_plugin_python Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu_plugin_query Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu_plugin_stress_internals Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nuon add raw-string literal support (#9956) 2024-05-02 09:36:37 -04:00
README.md Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00

Nushell core libraries and plugins

These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.

Foundational libraries are split into two kinds of crates:

  • Core crates - those crates that work together to build the Nushell language engine
  • Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.

Plugins are likewise also split into two types:

  • Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
  • Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.