Repository navigation
perf(executor): quote fast path for plain array values (#680) - #686
Merged
Merged
Conversation
quote_array_value ran 2 marker replaces + dequote scan + ansic_shouldquote + 4 chained replaces per element, even for plain digits. Whitelist (printable ASCII outside sh_double_quote escapes) renders "value" in one alloc; markers/CTLESC/non-ASCII fall through. seq100k mapfile ~181ms -> ~99ms (~1.8x). Matrix 25/26 (pre-existing NUL divergence only). GNU: array.c:948-989, strtrans.c:341, shquote.c:134, syntax.h:26.
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.
perf(executor): quote fast path for plain array values (#680)
What
Slice of the mapfile store-side residual:
quote_array_valueran 2marker
replaces + a dequote scan +ansic_shouldquote(with its ownencode) + 4 chained
replaces per element — even for plainseqdigits that need no escaping.
Fix
quote_array_value_is_plainwhitelist (non-empty printable ASCIIoutside the
sh_double_quoteescape set): renders"value"in asingle allocation. Markers/CTLESC/non-ASCII fail the byte test by
construction. GNU:
array.c:948-989(ansic_shouldquote ? ansic_quote : sh_double_quote),strtrans.c:341,shquote.c:134overslashify_in_quotes(syntax.h:26).Measured (release,
mapfile -t a < seq100k.txt589KB)baseline median ~181ms → ~99ms (≈1.8x end-to-end); GNU ref ~66–152
(noisy device, min-clusters).
Verification
issue680_mapfile_quote_fastpath_regressions(3 tests).array_store_parity2/2; quote suites 83/83; mapfile 24/24.mismatch is the documented pre-existing divergence; NUL is outside
the whitelist).
except the new regression file itself (3/3). Test-level 4 NEW, all in
the known-nondeterministic
part_080coproc family (all pass inisolation on branch). No regression.
6295367, only rubash[patch]switched): 50 vs 49, the single extra
(
epochrealtime_beats_external_date_for_timing) is the known loadflake — green in isolation on branch, both directions on master.