mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-11 11:26:34 +00:00
fix: avoid repeated seeks when skipping small GGUF metadata values (#2223)
This commit is contained in:
1 parent
e41fbcf455
commit
bb6b128b2d
1 file changed
+5
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user