Ok, next point of interest, regexp substitions with String.sub With my former optimizations for Regexps I got this: D:\Project\jruby>ruby testRegSubPerformance.rb Time1 0.581 Time2 0.58
D:\Project\jruby>bin\jruby testRegSubPerformance.rb Time1 8.623 Time2 5.428 where the test is more or less similar to other one. With the attached patch applied I get this: D:\Project\jruby>bin\jruby testRegSubPerformance.rb Time1 6.48 Time2 5.1770000000000005 which is quite good. And the only difference was to replace a RubyString with a StringBuffer in two lines which used append. I guess these small kinds of optimizations could get us some good performance at last. Regards Ola Bini ----- Original Message ----- From: Ola Bini <[EMAIL PROTECTED]> Date: Saturday, April 8, 2006 11:27 am Subject: Re: [Jruby-devel] Regexp performance. To: jruby-devel@lists.sourceforge.net > Ok, the second approach gave a little bit more: > > D:\Project\jruby>bin\jruby testRegexpPerformance.rb > Time1 5.168 for sum 150000 > Time2 3.9450000000000003 for sum 150000 > > But it's still not great. Anyway, I've attached the patch if this is > something we should continue work on. > > Regards > Ola Bini > > ----- Original Message ----- > From: Ola Bini <[EMAIL PROTECTED]> > Date: Saturday, April 8, 2006 11:23 am > Subject: Re: [Jruby-devel] Regexp performance. > To: jruby-devel@lists.sourceforge.net > > > Once again, a very small test where I replaced the > Pattern.compile in > > RegexpTranslator into a getPattern which saves all earlier > patterns > > in a > > hashmap. This actually worsens the performance slightly, so that's > > probably not the right way to go. I will try to apply this > approach to > > the whole RegexpTranslator.translate method instead and see what > > happens. > > Regards > > Ola Bini > > > > ----- Original Message ----- > > From: Ola Bini <[EMAIL PROTECTED]> > > Date: Saturday, April 8, 2006 10:53 am > > Subject: [Jruby-devel] Regexp performance. > > To: jruby-devel@lists.sourceforge.net > > > > > Hi there, > > > > > > I made a highly unscientific test of performance of regexps in > Ruby> > compared to JRuby. > > > The attached script is what I used to test this. The output is as > > > follows for 100 000 repetitions of the same regexp applying: > > > D:\Project\jruby>ruby testRegexpPerformance.rb > > > Time1 0.201 for sum 150000 > > > Time2 0.22 for sum 150000 > > > > > > D:\Project\jruby>bin\jruby testRegexpPerformance.rb > > > Time1 5.698 for sum 150000 > > > Time2 3.986 for sum 150000 > > > > > > This seems fairly good, actually, we're only an order of magnitude > > > slower, which is not so bad if you think about all the stuff > that's> > going on. The difference between Time1 and Time2 is what > happens > > if I > > > save the regexp in a variable before the loop, or not. As you > can > > see,> we could save pretty much performance here. > > > > > > Regards > > > Ola Bini > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by xPML, a groundbreaking > scripting > > languagethat extends applications into web and mobile media. > Attend > > the live webcast > > and join the prime developer group breaking into this new coding > > territory!http://sel.as- > > > us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642_______________________________________________ > > Jruby-devel mailing list > > Jruby-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/jruby-devel > > >
regsub.patch
Description: Binary data