From 4a24bdfabdfdcf251a6293bb5397804a01fa575c Mon Sep 17 00:00:00 2001 From: Douglas Hanley Date: Thu, 29 Feb 2024 16:08:44 -0600 Subject: [PATCH] dont construct new locale every time --- llama.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llama.cpp b/llama.cpp index 9160621609334..a35f07aa47cda 100644 --- a/llama.cpp +++ b/llama.cpp @@ -9001,12 +9001,13 @@ struct llm_tokenizer_wpm { } uint32_t to_lower(uint32_t code) { + static const std::locale locale("en_US.UTF-8"); #if defined(_WIN32) if (code > 0xFFFF) { return code; } #endif - return std::tolower(wchar_t(code), std::locale("en_US.UTF-8")); + return std::tolower(wchar_t(code), locale); } bool is_ascii_punct(uint32_t code) {