
Store Pattern's instead of calling Pattern.compile every time
malte0811 opened this issue ยท 1 comments
From a few profiling runs I did on ForgeCraft 1 this call seems to consistently take 2-3% of the CPU time on the render thread. I'm not sure why the caching doesn't seem to be more effective, or maybe it is effective, but regex compilation is even slower than I expect.
This call to String#replaceAll
might also be something to replace with a precomputed Pattern
, something like 0.1-0.2% are going into compiling that pattern every time.
Screenshot from JMC (total number of samples: 2113):