fix: avoid repeated seeks when skipping small GGUF metadata values (#2223)

This commit is contained in:
leejet authored and GitHub committed 2026-10-27 00:24:43 +08:00
1 parent e41fbcf455
commit bb6b128b2d
1 file changed
+5
+5
View File
@@ -60,7 +60,12 @@ private:
if (count > remaining_bytes_ / element_size)
return false;
uint64_t size = count * element_size;
// Seeking discards the read buffer, making arrays of short tokenizer strings expensive to skip.
if (size <= 64 * 1024) {
fin.ignore(static_cast<std::streamsize>(size));
} else {
fin.seekg(static_cast<std::streamoff>(size), std::ios::cur);
}
if (!fin.good())
return false;
remaining_bytes_ -= size;