Better algorithm to search tim files (use less memory).