Speed up log parsing with memoization