Skip to content

Commit

Permalink
cli/ndb: show fulltext search perf
Browse files Browse the repository at this point in the history
  • Loading branch information
jb55 committed Feb 6, 2024
1 parent 97fa802 commit a13a87b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ndb.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ int main(int argc, char *argv[])
ndb_text_search_config_set_order(&search_config, NDB_ORDER_ASCENDING);
argv++;
argc--;
} else if (!strcmp(argv[2], "--limit")) {
} else if (!strcmp(argv[2], "--limit") || !strcmp(argv[2], "-l")) {
limit = atoi(argv[3]);
ndb_text_search_config_set_limit(&search_config, limit);
argv += 2;
Expand All @@ -165,7 +165,13 @@ int main(int argc, char *argv[])
}

ndb_begin_query(ndb, &txn);
clock_gettime(CLOCK_MONOTONIC, &t1);
ndb_text_search(&txn, argv[2], &results, &search_config);
clock_gettime(CLOCK_MONOTONIC, &t2);

nanos = (t2.tv_sec - t1.tv_sec) * (long)1e9 + (t2.tv_nsec - t1.tv_nsec);

fprintf(stderr, "%d results in %f ms\n", results.num_results, nanos/1000000.0);

// print results for now
for (i = 0; i < results.num_results; i++) {
Expand Down

0 comments on commit a13a87b

Please sign in to comment.