Repository navigation
Conversation
This was referenced Oct 1, 2026
dnagoda
force-pushed
the
dc.batch-hot-path
branch
from
October 1, 2026 21:52
8c1ad74 to
f884e8f
Compare
dnagoda
added this pull request to stack #622
October 2, 2026 16:05
dnagoda
force-pushed
the
dc.batch-hot-path
branch
from
October 2, 2026 16:13
f884e8f to
e9ec4d1
Compare
dnagoda
force-pushed
the
dc.batch-hot-path
branch
from
October 2, 2026 16:35
e9ec4d1 to
57ff6af
Compare
dnagoda
force-pushed
the
dc.batch-hot-path
branch
2 times, most recently
from
October 2, 2026 16:56
1488364 to
fa8ae9d
Compare
dnagoda
marked this pull request as ready for review
October 2, 2026 16:59
dnagoda
force-pushed
the
dc.batch-hot-path
branch
from
October 2, 2026 21:35
fa8ae9d to
ac5ca3d
Compare
`BytesContainer::new` pretty-printed every input and output into a `humanized` string, and `run` deep-copied the input container for the I/O handler. Batch mode and `--json` never show that text, so for large inputs most of the time per input went to building and copying data that was then dropped. `BytesContainer` and `FunctionRunResult` now hold only data. A new public `views` module builds output from them on demand: - `ReadableBytes` gives the readable text for an input or an output. It replaces the `humanized` field. - `TextReport` is the default CLI report. It replaces the `Display` implementation on `FunctionRunResult`. - `JsonReport` is the `--json` output. It uses the result's serde serialization and replaces `FunctionRunResult::to_json`. The run also does less copying: - Move parsed JSON values into the container instead of cloning them. - `IOHandler` borrows the input instead of taking a deep copy. - Pass the Function output bytes to the container without a copy. An output that is not valid JSON or MessagePack now keeps its raw bytes, so "Output Size" shows the real size instead of 0B. This removes public items, so the version is 10.0.0. The unused `InvalidOutput` type and the `clap::ValueEnum` derive on `Codec` are removed too. The README lists the replacements.
dnagoda
force-pushed
the
dc.batch-hot-path
branch
from
October 6, 2026 21:34
ac5ca3d to
9ba2354
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
BytesContainer::newpretty-printed every input and every output into ahumanizedstring. Only the default text report shows that string. Batch mode and--jsonnever do.runalso deep-copied the whole input container, including that string, for the I/O handler, which reads only the raw bytes. For large inputs, most of the time per input went to building and copying data that was then dropped.--batch, release build, Apple M4 Pro, best of 3.noop.wasmechoes its input, so the output is as large as the input:exit_code.wasm)The saving grows with input and output size. A Function with a small output saves less, because only the input-side work goes away.
What
BytesContainerandFunctionRunResultnow hold only data. A new publicviewsmodule builds output from them when it is displayed:ReadableBytes::from(&container): readable text for an input or an output (pretty JSON, a hex dump for theRawcodec, or lossy UTF-8 for output that does not decode). It replaces thehumanizedfield.TextReport::from(&result): the default CLI report. It replaces theDisplayimplementation onFunctionRunResult, and the report text does not change.JsonReport::from(&result): the--jsonoutput. It uses the result's serde serialization and replacesFunctionRunResult::to_json.FunctionRunResultandBytesContainerkeepSerializeandDeserialize.The run also does less copying:
IOHandlerborrows the input container instead of taking a copy.BytesContainer::newwithout a copy.Breaking changes (10.0.0)
This removes public items, so the version is 10.0.0. The README has an "Upgrading to 10.0" section.
container.humanizedReadableBytes::from(&container).to_string()result.to_string()orformat!("{result}")TextReport::from(&result).to_string()result.to_json()JsonReport::from(&result).to_string()BytesContainer::rawkeeps the bytes of an output that does not decode. In 9.x it was empty.InvalidOutputtype and theclap::ValueEnumderive onCodecare removed.Behavior
CLI output is byte-for-byte identical to #620 for
noop,exit_code,js_function,js_function_javy_plugin_v3,messagepack-valid,messagepack-invalid, andlog_truncation_function, in text and--jsonmodes. Batch output is identical with and without--batch-full-outputand--batch-continue-on-error. There is one exception:messagepack-invalid.wasmshows10Bwhere it showed0B.Shopify CLI runs the
function-runnerbinary and parses only--jsonoutput, which does not change. It pins function-runner 9.2.2, so it needs a version bump to pick this up.Not changed
Batch output still flushes after each record. A
BufWritersaved about 11% on 10,000 tiny records, but then a caller that writes one input and waits for its record would block. Records must arrive as soon as each input completes.Testing
cargo test --locked: 39 unit tests and 36 integration tests pass; one existing test remains ignored.src/views.rs. New tests cover pretty JSON, theRawhex dump, undecodable output, andJsonReportmatching serde output.cargo clippy --locked -- -D warningsandcargo fmt --all -- --checkpass.