Q:

Java regex performance metrics?

Given the following code, how can I get metrics for a regular expression?  Does Matcher and Pattern give any visibility into the performance of a match/find or would I have to calculate this manually?
Something like this:
String text = "...some really big string of containing a pattern to match...";
        Pattern PATTERN = Pattern.compile("<the pattern to match>",
                Pattern.DOTALL);
        Matcher m = PATTERN.matcher(text);
        if (m.find()) {
          // ????? How long did find() take to match the pattern ?????
        }

A:

To answer your question, if there are no methods to access performance metrics, then there is no visibility.  Java doesn't have any concept of hiding special methods for some purpose or another that are secretly accessible through some special trick.  
If you're wanting performance metrics you'll just have to use System.currentTimeMillis() (or if you're needing more resolution, System.nanoTime()) and note the difference in time between starting and ending your methods.

