-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SkipRunes, DropRunes #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two comments about local size variable consistency and for my own understanding, how the rune logic works. Thanks
@matthewsanetra Regarding point 6, when we take |
Very good idea! Changing now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved -- let's hope the tests trigger for this PR
173e2c5
to
fd79f20
Compare
Woohoo! Tests passed. Merging. @matthewsanetra thanks for the updates! Great stuff 🚀 |
Per discussion in #3, I've implemented
SkipRunes
,DropRunes
.I have also made the following changes:
DropString
unsafe
and avoid the extra allocation, but at the time I figured it wasn't worth it as . Since then I have foundstrings.Builder
, which internally performs theunsafe
conversion and saves us an allocation.append
inDrop
append
, but we can eliminate that by just making the slice with the final length at the beginning and copying the elements withcopy
. Should have no (negative) change in performance as all allocations in Go are zero'd anyways (so no internal optimisations done byappend
).Skip
,SkipString
Drop
, but notSkip
, and so now we return a slice of the same underlying array, but with length 0, maintaining a reference to that underlying array.Skip
,Drop
,... to non-negative integersUnskip
method, and it is up to debate whether we would ever expose such functionality (re. idiomaticity)String
functions into their own fileRunes
functions are in their own file.