| Since XRENDERING-644, the constructor of AbstractChainingListener calls getDeclaredMethods() on each class of the listener's hierarchy to detect subclasses that only implement the old signatures of endListItem() / onImage(). getDeclaredMethods() copies all Method objects on each call, and chaining listeners are created very often: renderers are per-lookup components, and for example every $services.localization.render() call creates a plain text renderer with its chain of listeners. On a local profile of Sandbox.WebHome (standard flavor, master), this check takes 4.2% of the request CPU. Change Compute the result once per listener class with a ClassValue, which keeps the value on the class itself, so classes of uninstalled or upgraded extensions are still garbage collected and a new version of a class gets its own result. |