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

Make allocating field names avoidable for range and exists queries. #2308

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adamreichold
Copy link
Contributor

If the field names are statically known, Cow::Borrowed(&'static str) can handle them without allocations. The general case is still handled by Cow::Owned(String).

If the field names are statically known, `Cow::Borrowed(&'static str)` can
handle them without allocations. The general case is still handled by
`Cow::Owned(String)`.
@PSeitz
Copy link
Contributor

PSeitz commented Apr 10, 2024

I don't think a single allocation per query won't have a measurable impact on performance, therefore I'd prefer the more readable variant.

@adamreichold
Copy link
Contributor Author

therefore I'd prefer the more readable variant.

I tried to anticipate this via the trait bound Into<Cow<'static, str>> so that call sites do not need to care about the Cows. But I suspect you mean readability of the implementation?

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.

None yet

2 participants