Skip to content

Commit 14d93c7

Browse files
common, ngram_cache: added const reference for std::pair<> and std::tuple<> more 16 bytes: ggml-org#7270
Co-Authored-By: Herman Semenov <21138600+germanaizek@users.noreply.github.com>
1 parent c65f5b6 commit 14d93c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

common/ngram-cache.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ void llama_ngram_cache_draft(
306306

307307
void llama_ngram_cache_save(llama_ngram_cache & ngram_cache, std::string & filename) {
308308
std::ofstream file_out(filename, std::ios::binary);
309-
for (std::pair<llama_ngram, llama_ngram_cache_part> item : ngram_cache) {
309+
for (const std::pair<llama_ngram, llama_ngram_cache_part> & item : ngram_cache) {
310310
const llama_ngram ngram = item.first;
311311
llama_ngram_cache_part token_counts = item.second;
312312
GGML_ASSERT(!token_counts.empty());
@@ -366,7 +366,7 @@ llama_ngram_cache llama_ngram_cache_load(std::string & filename) {
366366
}
367367

368368
void llama_ngram_cache_merge(llama_ngram_cache & ngram_cache_target, llama_ngram_cache & ngram_cache_add) {
369-
for (std::pair<llama_ngram, llama_ngram_cache_part> ngram_part : ngram_cache_add) {
369+
for (const std::pair<llama_ngram, llama_ngram_cache_part> & ngram_part : ngram_cache_add) {
370370
const llama_ngram ngram = ngram_part.first;
371371
llama_ngram_cache_part part = ngram_part.second;
372372

0 commit comments

Comments
 (0)