tantivy icon indicating copy to clipboard operation
tantivy copied to clipboard

Make allocating field names avoidable for range and exists queries.

Open adamreichold opened this issue 1 year ago • 2 comments

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).

adamreichold avatar Jan 26 '24 16:01 adamreichold

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.

PSeitz avatar Apr 10 '24 07:04 PSeitz

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?

adamreichold avatar Apr 10 '24 09:04 adamreichold