I have been doing some profiling on the webapp and looking at ways to minimize overhead. One of the things that I found was the call to CharsetUtils.delete method in the AbstractMonitor.init method. According to the profiler, majority of the time spent in initialization of the monitor is spent in this call.
I also did tests locally and found that it takes around 60-70 ms to call this method.
Since we only need to call this method if there are any invalid characters in the monitor name, can we do a regex pattern matching check before calling this method to test if the invalid characters exist? I ran this code
I found that if name does not contain invalid characters, the match finishes in about 3ms (non-profiled).