♻️ Style tweaks to RawData.split update - #762
Merged
Merged
Conversation
This is an addendum to #745. This keeps it more in the original style, without sacrificing performance, as far as I can tell. While many style guides (and people) may avoid the regexp globals, this code base uses them more often than not. And their function here should be obvious from the local variable names. I find this version _(subjectively)_ easier to read. Also, using two offsets rather (`text_start` and `literal_start`) and assigning all of the regexp vars at the start of the loop is arguably simpler. And anyway, both versions are `O(n)`, and optimizing `RawData` beyond that isn't very important. So, while it's nice for this code to be faster, keeping the structure easier to understand is higher priority.
nevans
force-pushed
the
raw_data-split-style
branch
from
September 8, 2026 21:53
865c3c7 to
e7e91f9
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.
This is an addendum to #745. This keeps it more in the original style, without sacrificing performance, as far as I can tell.
While many style guides (and people) may avoid the regexp globals, this code base uses them more often than not. And their function here should be obvious from the local variable names. I find this version (subjectively) easier to read.
Also, using two offsets rather (
text_startandliteral_start) and assigning all of the regexp vars at the start of the loop is arguably simpler.And anyway, both versions are
O(n), and optimizingRawDatabeyond that isn't very important. So, while it's nice for this code to be faster, keeping the structure easier to understand is higher priority.