Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The call to `ord()` and the list comprehension both showed up in my profiler. Some observations: - The call to `ord()` doesn't need to happen every iteration of that list comprehension. - A list isn't necessary, we can stop searching once we've found a hit. - The list is sorted, so we can be sure that if a char is lower than the upper bound of a group, we don't need to evaluate any of the higher ranges. - Technically we could also do a binary search instead of a linear one, but I'm assuming that, overall, most chars will be in the lowest ranges (ascii) and the loop will abort on its first iteration.
- Loading branch information