From: Glen Starchman Date: 2001-05-27T00:36:09+09:00 Subject: [ruby-talk:15764] Re: java based interpreter and regexes > Fundamentally, Java has a lot of overhead that slows things down. I don't > care if you hand-tune this overhead in assembly; it is still going to be > slower than the same code without the overhead (Object allocation, garbage > collection, exception handling, etc). While I don't believe that Java is > as slow as a lot of people think it is, I have yet to see any evidence of > a Java application outperforming a native, compiled application -- your > benchmarks aside :-) Hm... it seems to me that a regex implementation that was simply an extension of the java.lang.String class might be a lot faster. Just from the brief look I have given the source of the Apache regex engine it looks like there is a lot of overhead in creating String and StringBuffer objects to support the regex engine. I could be wrong, though... like I said I have barely glanced at the code. For example: class RubyString extends String implements RubyRegex ... > > With most of the time (of this program) being spent in native code on the > Ruby side, if we can prove that your benchmarks are not the result of a > fluke (Cygwin is anti-optimizing, Sun is cheating by having the regex > code in a native library, or some such nonsense), then I'd suggest that we > take a look at the Ruby regex code and look for speedbumps. > Unless we would be seeking 100% Java certification, there is nothing stopping us from using JNI and creating native regex libraries for each supported platform. It's very, very ugly, but certainly could be done. Nor is there anything stopping us from a virtual translation of the Ruby source tree (except for the YACC ickyness) into pure Java. Just some thoughts.