The high frequent handling of an object being necessary for each event listening, especially when the probes are inserted into String class, makes this scenario prone to poor performance. We can improve the overall performance by the following optimization methods:
- Replace the
StringUtils.replace with String.replace
- Use
StringBuilder instead of String.format —— As this issue shows, this might lead to tenfold improvement in performance.
- Loading target classes when necessary rather than each time when event fires.
The high frequent handling of an object being necessary for each event listening, especially when the probes are inserted into
Stringclass, makes this scenario prone to poor performance. We can improve the overall performance by the following optimization methods:StringUtils.replacewithString.replaceStringBuilderinstead ofString.format—— As this issue shows, this might lead to tenfold improvement in performance.