Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
ezra-varady committed Oct 11, 2023
1 parent b1f1c29 commit cd6686e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/hnsw/insert.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ bool ldb_aminsert(Relation index,
double mL = 1 / log(M);
uint32 node_size = UsearchNodeBytes(&meta, opts.dimensions * sizeof(float), (int)(mL + .5));
// accuracy could be improved by not rounding mL, but otherwise this will never be fully accurate
if (node_size * (hdr->num_vectors + 1) > work_mem * 1024L) {
if(node_size * (hdr->num_vectors + 1) > work_mem * 1024L) {
elog(WARNING, "index size exceeded work_mem during insert");
}

Expand Down
16 changes: 8 additions & 8 deletions src/hnsw/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,14 @@ bool ldb_amgettuple(IndexScanDesc scan, ScanDirection dir)
scanstate->labels = palloc(k * sizeof(usearch_label_t));
}

double M = ldb_HnswGetM(scan->indexRelation);
double mL = 1 / log(M);
double M = ldb_HnswGetM(scan->indexRelation);
double mL = 1 / log(M);
usearch_metadata_t meta = usearch_metadata(scanstate->usearch_index, &error);
uint32 node_size = UsearchNodeBytes(&meta, scanstate->dimensions * sizeof(float), (int)(mL + .5));
uint32 node_size = UsearchNodeBytes(&meta, scanstate->dimensions * sizeof(float), (int)(mL + .5));
// accuracy could be improved by not rounding mL, but otherwise this will never be fully accurate
// I think because of mem_view_lazy a max of k nodes will be held in memory by usearch
// there are separate checks on the memory held by takenbuffers
if (node_size * k > work_mem * 1024L) {
if(node_size * k > work_mem * 1024L) {
elog(WARNING, "index size exceeded work_mem during scan");
}

Expand Down Expand Up @@ -240,11 +240,11 @@ bool ldb_amgettuple(IndexScanDesc scan, ScanDirection dir)
scanstate->distances = repalloc(scanstate->distances, k * sizeof(float));
scanstate->labels = repalloc(scanstate->labels, k * sizeof(usearch_label_t));

double M = ldb_HnswGetM(scan->indexRelation);
double mL = 1 / log(M);
double M = ldb_HnswGetM(scan->indexRelation);
double mL = 1 / log(M);
usearch_metadata_t meta = usearch_metadata(scanstate->usearch_index, &error);
uint32 node_size = UsearchNodeBytes(&meta, scanstate->dimensions * sizeof(float), (int)(mL + .5));
if (node_size * k > work_mem * 1024L) {
uint32 node_size = UsearchNodeBytes(&meta, scanstate->dimensions * sizeof(float), (int)(mL + .5));
if(node_size * k > work_mem * 1024L) {
elog(WARNING, "index size exceeded work_mem during scan");
}

Expand Down

0 comments on commit cd6686e

Please sign in to comment.