]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Avoid repeated simdutf implementation detection on each call
authorVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 4 Dec 2025 15:41:56 +0000 (15:41 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 4 Dec 2025 15:41:56 +0000 (15:41 +0000)
The previous code stored a pointer to simdutf's proxy singleton instead
of the actual implementation, causing detect_best_supported() to be
called on every UTF-8 validation operation.

src/libutil/cxx/rspamd-simdutf.cxx

index 81140388455b2c1554e396d134f453e7917873b4..219ec820577ddb4478bb385d60890a7ebd449dc9 100644 (file)
@@ -28,8 +28,8 @@ const simdutf::implementation *ref_impl{nullptr};
 
 void rspamd_fast_utf8_library_init(unsigned flags)
 {
-       impl = simdutf::get_active_implementation();
        auto all_impls = simdutf::get_available_implementations();
+       impl = all_impls.detect_best_supported();
 
        for (auto &i: all_impls) {
                if (i->name() == "fallback") {