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 language
that 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

Reply via email to