Skip to content

add fill_tape_padded to skip the internal input copy - #472

Open
ranflarion wants to merge 1 commit into
simd-lite:mainfrom
ranflarion:ran/fill-tape-padded
Open

add fill_tape_padded to skip the internal input copy#472
ranflarion wants to merge 1 commit into
simd-lite:mainfrom
ranflarion:ran/fill-tape-padded

Conversation

@ranflarion

Copy link
Copy Markdown

First half of #469: the padded entry point, without the UTF-8 validation skip (independent, can follow separately).

fill_tape_padded(s, len, buffers, tape) plus INPUT_PADDING. Callers that control the input layout supply the SIMD over-read padding themselves, skipping the O(len) copy fill_tape makes into its internal buffer: +2% to +7% on the shapes measured in #469, growing with document size.

With that copy gone stage 2 reads the same buffer string unescaping writes into, so the read side can no longer be a &[u8] argument (argument protectors under both borrow models, and noalias readonly). It becomes InputView, a pub(crate) pointer+len threaded through build_tape and the per-ISA parse_str, with build_tape taking *mut u8 for the write side. fill_tape still passes a disjoint copy, so that path is unchanged.

One correction to the issue: since 011d699 dropped NUL from the structural-or-whitespace tables the padding is not arbitrary, s[len] has to be structural or whitespace (b' ' works). Documented, and root_scalars_terminated_by_padding covers it.

tests/fill_tape_padded.rs pins the result against fill_tape node-for-node over lane-boundary escape positions, escapes landing against the padding, shared multi-row scratches, error paths and a random corpus. Miri-clean under Stacked and Tree Borrows on both aarch64 and x86_64, which may be useful for #446/#450; full suite, feature matrix, clippy and fmt green.

Happy to rename things or keep InputView out of parse_str's signature if you'd prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant