JetBrains TODO preforms a RegEx search of potentially large amounts of text, so if there is a time-consuming pattern in your TODOs, things can slow considerably, or even hang.
The problem lies with any regular expression matches that may have been defined to identify TODO items. The Java standard regular expression library used by JetBrains IDEs to match these items uses an algorithm of exponential complexity to search for '*.a'
and similar patterns.
Theoretically, it is possible to match any regexp very fast (a linear algorithm exists), > but many developers of regexp libs simply don't bother implementing it.
In general, if your TODOs are lowing things down, look to the RegEx in your TODO items and see if you can narrow the scope of matches in order to improve performance.
BTW, the same problem exists for the Python re module:
>>> from timeit import timeit
>>> timeit("import re; list(re.finditer('.*a', 'foo' * 10000))", number=1)
0.6927990913391113
>>> timeit("import re; list(re.finditer('.*a', 'foo' * 50000))", number=1)
17.076900005340576