off_t pool_offset = ntohl(header.pool_offset);
size_t pool_length = ntohl(header.pool_length);
- int r = loc_stringpool_new(db->ctx, &db->pool, 0);
- if (r)
- return r;
-
- r = loc_stringpool_read(db->pool, db->file, pool_offset, pool_length);
+ int r = loc_stringpool_open(db->ctx, &db->pool,
+ db->file, pool_length, pool_offset);
if (r)
return r;
off_t lo = 0;
off_t hi = db->as_count - 1;
+ // Save start time
+ clock_t start = clock();
+
while (lo <= hi) {
off_t i = (lo + hi) / 2;
// Check if this is a match
uint32_t as_number = loc_as_get_number(*as);
- if (as_number == number)
+ if (as_number == number) {
+ clock_t end = clock();
+
+ // Log how fast this has been
+ DEBUG(db->ctx, "Found AS%u in %.8fs\n", as_number,
+ (double)(end - start) / CLOCKS_PER_SEC);
+
return 0;
+ }
// If it wasn't, we release the AS and
// adjust our search pointers
// Nothing found
*as = NULL;
- return 0;
+ return 1;
}