commit | aac856a831af114541346cc53c5cfe3fa1fb7208 | [log] [tgz] |
---|---|---|
author | Adrien Grand <jpountz@gmail.com> | Tue May 21 09:12:44 2024 +0200 |
committer | GitHub <noreply@github.com> | Tue May 21 09:12:44 2024 +0200 |
tree | adc33fccc89ed62b6dcf40202aae4063384c145f | |
parent | 22d50be2eab84c9a75ea65f55fcc4356724faba1 [diff] |
Reduce the overhead of `IndexInput#prefetch` when data is cached in RAM. (#13381) As Robert pointed out and benchmarks confirmed, there is some (small) overhead to calling `madvise` via the foreign function API, benchmarks suggest it is in the order of 1-2us. This is not much for a single call, but may become non-negligible across many calls. Until now, we only looked into using prefetch() for terms, skip data and postings start pointers which are a single prefetch() operation per segment per term. But we may want to start using it in cases that could result into more calls to `madvise`, e.g. if we start using it for stored fields and a user requests 10k documents. In #13337, Robert wondered if we could take advantage of `mincore()` to reduce the overhead of `IndexInput#prefetch()`, which is what this PR is doing via `MemorySegment#isLoaded()`. `IndexInput#prefetch` tracks consecutive hits on the page cache and calls `madvise` less and less frequently under the hood as the number of consecutive cache hits increases.
Apache Lucene is a high-performance, full-featured text search engine library written in Java.
This README file only contains basic setup instructions. For more comprehensive documentation, visit:
gradlew
).We‘ll assume that you know how to get and set up the JDK - if you don’t, then we suggest starting at https://jdk.java.net/ and learning more about Java, before returning to this README.
See Contributing Guide for details.
Bug fixes, improvements and new features are always welcome! Please review the Contributing to Lucene Guide for information on contributing.
#lucene
and #lucene-dev
on freenode.net