usearch 2.21.1 → 2.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
#define USEARCH_VERSION_MAJOR 2
|
|
11
11
|
#define USEARCH_VERSION_MINOR 21
|
|
12
|
-
#define USEARCH_VERSION_PATCH
|
|
12
|
+
#define USEARCH_VERSION_PATCH 2
|
|
13
13
|
|
|
14
14
|
// Inferring C++ version
|
|
15
15
|
// https://stackoverflow.com/a/61552074
|
|
@@ -3806,6 +3806,25 @@ class index_gt {
|
|
|
3806
3806
|
return {nodes_mutexes_, slot};
|
|
3807
3807
|
}
|
|
3808
3808
|
|
|
3809
|
+
struct optional_node_lock_t {
|
|
3810
|
+
nodes_mutexes_t& mutexes;
|
|
3811
|
+
std::size_t slot;
|
|
3812
|
+
inline ~optional_node_lock_t() noexcept {
|
|
3813
|
+
if (slot != std::numeric_limits<std::size_t>::max())
|
|
3814
|
+
mutexes.atomic_reset(slot);
|
|
3815
|
+
}
|
|
3816
|
+
};
|
|
3817
|
+
|
|
3818
|
+
inline optional_node_lock_t optional_node_lock_(std::size_t slot, bool condition) const noexcept {
|
|
3819
|
+
if (condition) {
|
|
3820
|
+
while (nodes_mutexes_.atomic_set(slot))
|
|
3821
|
+
;
|
|
3822
|
+
return {nodes_mutexes_, slot};
|
|
3823
|
+
} else {
|
|
3824
|
+
return {nodes_mutexes_, std::numeric_limits<std::size_t>::max()};
|
|
3825
|
+
}
|
|
3826
|
+
}
|
|
3827
|
+
|
|
3809
3828
|
struct node_conditional_lock_t {
|
|
3810
3829
|
nodes_mutexes_t& mutexes;
|
|
3811
3830
|
std::size_t slot;
|
|
@@ -4133,6 +4152,8 @@ class index_gt {
|
|
|
4133
4152
|
node_try_conditional_lock_(candidate_slot, updated_slot != candidate_slot, failed_to_acquire);
|
|
4134
4153
|
if (failed_to_acquire)
|
|
4135
4154
|
continue;
|
|
4155
|
+
auto optional_node_lock =
|
|
4156
|
+
optional_node_lock_(candidate_slot, updated_slot == candidate_slot);
|
|
4136
4157
|
neighbors_ref_t candidate_neighbors = neighbors_(candidate_ref, level);
|
|
4137
4158
|
|
|
4138
4159
|
// Optional prefetching
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|