Path: csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: Question about Pattern.matcher performance differences between Java6 and Java7/8 Date: Tue, 24 Dec 2013 09:31:03 -0500 Organization: A noiseless patient Spider Lines: 27 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 24 Dec 2013 14:31:07 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="858a9d65d95f4ea4d355bd116aa2cdbf"; logging-data="1693"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+4ew/fQ0co5RIUl5CMQb9w" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: Cancel-Lock: sha1:CIqUfaLo5GiBPGDV1c7NLnayqd0= Xref: csiph.com comp.lang.java.programmer:27072 On 12/24/2013 7:26 AM, zach.lists@gmail.com wrote: > Hello, > > I've noticed a difference in performance between Java6 and Java7/8 (Oracle) on OS X with some toy code. Java6 runs much faster than the updated versions. > > VisualVM is pointing me to java.util.regex.Pattern.matcher being the hotspot where all the time is now spent. > > I'm still trying to slim down the offending code into a concise example. However I was wondering if anyone knew if there were any changes in java.util.regex.Pattern.matcher performance between Java6 and Java7? > > I've read that named groups were introduced in Java7, but I haven't found anything mentioning performance tanking dramatically. > > Thanks for any leads you folks may be able to point me to. One suggestion: Don't fret about the performance of "toy code." If the performance of "real code" suffers, that's another matter. Note, though, that if Pattern.matcher() has suddenly become the hot spot in real code it doesn't necessarily follow that Pattern.matcher() has become slower. It might instead mean that something else is now matching a lot more regexes than it used to, or is using a more complex regex than before. If your car's fuel economy suddenly gets worse it doesn't prove the engine's gone bad, it may instead have something to do with the boat trailer you've hitched on ... -- Eric Sosman esosman@comcast-dot-net.invalid