Commit bbf88517 authored by Sergei Golubchik's avatar Sergei Golubchik

mhnsw: remove a redundant loop and ha_update_row

parent 0235ae9a
...@@ -399,24 +399,17 @@ static int update_second_degree_neighbors(MHNSW_Context *ctx, size_t layer, ...@@ -399,24 +399,17 @@ static int update_second_degree_neighbors(MHNSW_Context *ctx, size_t layer,
uint max_neighbors, uint max_neighbors,
const FVectorNode &node) const FVectorNode &node)
{ {
for (const FVectorNode &neigh: node.get_neighbors(layer)) // XXX why this loop?
{
neigh.get_neighbors(layer).push_back(&node, &ctx->root);
if (int err= write_neighbors(ctx, layer, neigh))
return err;
}
for (const FVectorNode &neigh: node.get_neighbors(layer)) for (const FVectorNode &neigh: node.get_neighbors(layer))
{ {
neigh.get_neighbors(layer).push_back(&node, &ctx->root);
if (neigh.get_neighbors(layer).elements > max_neighbors) if (neigh.get_neighbors(layer).elements > max_neighbors)
{ {
// shrink the neighbors
if (int err= select_neighbors(ctx, layer, neigh, if (int err= select_neighbors(ctx, layer, neigh,
neigh.get_neighbors(layer), max_neighbors)) neigh.get_neighbors(layer), max_neighbors))
return err; return err;
if (int err= write_neighbors(ctx, layer, neigh))
return err;
} }
if (int err= write_neighbors(ctx, layer, neigh))
return err;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment