+ // Sneak in fetching the dictionary, if present. It's not necessarily clear
+ // exactly where it would be cheapest to get it, but it needs to be present
+ // before we can decode any of the posting lists. Most likely, it's
+ // in the same filesystem block as the header anyway, so it should be
+ // present in the cache.
+ {
+ const Header &hdr = corpus.get_hdr();
+ if (hdr.zstd_dictionary_length_bytes > 0) {
+ engine.submit_read(fd, hdr.zstd_dictionary_length_bytes, hdr.zstd_dictionary_offset_bytes, [](string_view s) {
+ ddict = ZSTD_createDDict(s.data(), s.size());
+ dprintf("Dictionary initialized after %.1f ms.\n", 1e3 * duration<float>(steady_clock::now() - start).count());
+ });
+ }
+ }
+