Skip to content
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

Include native version of reverse for InlineStrings #27

Merged
merged 2 commits into from
Apr 19, 2022
Merged

Conversation

quinnj
Copy link
Member

@quinnj quinnj commented Apr 19, 2022

This is the first in a series of PRs where I'm going to attempt to
provide "native" string functions that operate on and return
InlineStrings. The advantage is that when working with InlineStrings,
the normal set of string functions won't "poison" your data by
unnecessarily introducing Strings, but will operate directly on the
InlineString type and return the same type when possible.

The reverse function is a good example of that: it can always return
the same type as the input, and in my benchmarks, it can be 2-4x faster
than the "default" String method.

This is the first in a series of PRs where I'm going to attempt to
provide "native" string functions that operate on and return
InlineStrings. The advantage is that when working with InlineStrings,
the normal set of string functions won't "poison" your data by
unnecessarily introducing `String`s, but will operate directly on the
InlineString type and return the same type when possible.

The `reverse` function is a good example of that: it can always return
the same type as the input, and in my benchmarks, it can be 2-4x faster
than the "default" `String` method.
@quinnj quinnj merged commit d1cfff0 into main Apr 19, 2022
@quinnj quinnj deleted the jq/reverse branch April 19, 2022 14:08
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.

1 participant