unum-cloud / usearch

Fast Open-Source Search & Clustering engine × for Vectors & 🔜 Strings × in C++, C, Python, JavaScript, Rust, Java, Objective-C, Swift, C#, GoLang, and Wolfram 🔍
https://unum-cloud.github.io/usearch/
Apache License 2.0
2.27k stars 142 forks source link

Fix dummy prefetch checks #243

Closed al13n321 closed 1 year ago

al13n321 commented 1 year ago

I accidentally noticed that all the if (!std::is_same<prefetch_at, dummy_prefetch_t>::value) checks aren't actually working. The prefetch_at template argument gets inferred as dummy_prefetch_t &, so the is_same returns false, and the prefetch() call happens even for dummy prefetch. (Then presumably gets inlined and optimized out.)

This PR replaces the check with if (!std::is_same<typename std::decay<prefetch_at>::type, dummy_prefetch_t>::value). Idk if it's the most concise or "correct" way to do it, but it works.

ashvardanian commented 1 year ago

Hey, @al13n321! You are right, thank you for patch! I’ll mege into development branch and release soon.

ashvardanian commented 1 year ago

:tada: This PR is included in version 2.1.2 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: