I have an inspection that invokes some heavy PSI stuff on possibly
hundreds of files. It runs very slowly. It looks like a lot of the time
is spent in things like CompositeElement.getChildren() and
.countChildren, and also in some custom PSI methods for my language.
The files aren't modified frequently, so most of this data could be
cached. However, I don't feel that I understand some parts of PSI well
enough to make a correct cache. Is a PSI tree mutable? Is it a good idea
for a method to cache its children, or some processed version of its
getText(), in a field? If not, is PSI tree listener the best way to
build such a cache?