Repository navigation
Conversation
… run table), total and pure, emitted as static inline C only when called: a lexer's skip-while-in-class loop is one call with no per-byte bound check. Programs without them emit the same C; s2c self-compile instructions unchanged (5.000 G). Test prog/str_scan checks both against plain byte loops on 2000 pseudo-random cases
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.
Two string scans for lexers (bead vic-de9x.27; snx lexer port, which costs +5.4% instructions against its C lexer today).
Str.find(s, i, c): the first index >= i whose byte is c, elseStr.len(s)(one memchr).Str.runWhile(s, i, n, t): the first index >= i whose byte b is not in the run table t (b >= nort(b) == 0), elseStr.len(s)(one loop over raw bytes, no per-byte bound check).Evidence:
prog/str_scanchecks both against plain byte loops on 2000 pseudo-random strings and edge starts: 0 disagreements. Mutant (runWhile returns one past the stop): 1379 disagreements.--memgoldens change only by the new externs' params and the prelude line shift.