Skip to content

♻️ Style tweaks to RawData.split update - #762

Merged
nevans merged 3 commits into
masterfrom
raw_data-split-style
Sep 8, 2026
Merged

♻️ Style tweaks to RawData.split update#762
nevans merged 3 commits into
masterfrom
raw_data-split-style

Conversation

@nevans

@nevans nevans commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

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.

OskarEichler and others added 3 commits August 28, 2026 00:25
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
nevans force-pushed the raw_data-split-style branch from 865c3c7 to e7e91f9 Compare September 8, 2026 21:53
@nevans
nevans merged commit 61c8d3e into master Sep 8, 2026
34 checks passed
@nevans
nevans deleted the raw_data-split-style branch September 8, 2026 21:55
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.

2 participants