-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Split std.mem.split and tokenize into sequence, any, and scalar versions
#15579
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
Conversation
|
I was curious myself so I investigated in Godbolt https://zig.godbolt.org/z/84qYfvejq (see How about Alternatively, or in addition, what if we have a sensible default which would be simply called And then for any advanced uses one can use one of the two new functions you added here. We already do this for other functions too. There is |
|
I agree with keeping the name of the new |
|
The reason for deprecating Other than that,
EDIT: Also, just for clarity, in this PR |
std.mem.split and tokenize into full, any, and scalar versionsstd.mem.split and tokenize into sequence, any, and scalar versions
…ter type: full, any, and scalar This allows users to choose which version they need for their particular use case, as the previous default (now the 'full' version) was (1) not always the desired type of delimiter and (2) performed worse than the scalar version if the delimiter was a single item.
…y, and scalar This allows users to choose which version they need for their particular use case, as the previous default (now the 'any' version) was (1) not always the desired type of delimiter and (2) performed worse than the scalar version if the delimiter was a single item.
Everywhere that can now use `tokenizeScalar` should get a nice little performance boost.
Everywhere that can now use `splitScalar` should get a nice little performance boost.
I think this makes the name less ambiguous and more obvious that the suffix applies to the `delimiter`.
std.mem.splitis now an alias forstd.mem.splitSequenceandstd.mem.tokenizeis now an alias forstd.mem.tokenizeAnywith a deprecation doc comment on each ofsplitandtokenizesplit, didn't check the performance difference oftokenizeAnyversustokenizeScalarAny suggestions for a better name for the
Fullversion are welcome. EDIT: MaybeSequence? EDIT#2: Went withSequencefor now