Re: java.util.regex

"Andrew John Hughes" <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
2008/5/8 Andrew Haley <[email protected]>:
>
> OneGuy wrote:
>  > On Thu, May 8, 2008 at 4:22 AM, Andrew Haley <[email protected]> wrote:
>  >
>  >> That may be so.  On the other hand, perhaps Sun's JIT has discovered
>  >> a smart optimization that isn't visible to gcc.  Profililng the
>  >> program may show what is happenining.
>  >
>  > Even a much serious problem is with java.util.regex  .. specifically,
>  > this method
>  >
>  > http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
>  >
>  > static Pattern compile(String regex)
>  >
>  > The String I tested (very large string), java6 could execute the
>  > method in few seconds. GCJ took more than one minute. It was more than
>  > 40 times slower.
>
>  Well, it's a completely independent implementation.  In what way is
>  this a serious problem for you?
>
>  Andrew.
>

I've noticed speed problems with our regex implementation too in the past,
when using it as part of a web scraper, matching against large HTML files.
I made a mental note to look at it, and now, about three years later, I'm
doing that to some extent in implementing the 1.6 features of the regex
package.

As Andrew says, I suggest you outline exactly why this is a problem for you and
the testcase you mention, preferably in a bug report -
http://gcc.gnu.org/bugzilla/

Our regex implementation has never received much love because it was largely
imported, as far as I'm aware, from a GNU regex package developed elsewhere.
There's a lot of needless synchronisation in there for one thing,
brought about by
using the old synchronised collections.

We've also not made a habit of optimising for performance, mainly because we've
been playing catchup all these years.  IMO, if there was one thing we
could import
from OpenJDK, the regex package would probably be it and I might do this via
BrandWeg when I get chance.  Not that that would help GCJ, as a
drop-in glibj.zip
replacement won't work there.

Thanks,
-- 
Andrew :-)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.