logging time and memory usage to profile speedups
avoid realloc/copy in get_hits - 20x faster for large queries