Performance of JRuby StringScanner

I’ve been playing around with lexers that rely on the Ruby StringScanner
to recognize lexical tokens. For large texts, the lexers are roughly
twice as slow in JRuby as in MRI. I haven’t probed any further, but am
wondering if there are known performance issues in this area. It looks
like both MRI and JRuby have “native” implementations of StringScanner.

// Gregory


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi Gregory,

I’m not aware of any performance issues with StringScanner in JRuby.
It should be generally fast.

In my experiments I see that indeed by default JRuby is on par or a
bit faster than MRI, and in -J-server mode it is sometimes TWICE as
fast.

It would be great if you could share the sources of your benchmark or
provide a simplified benchmark that shows the problem.

Thanks,
–Vladimir

On Fri, Jun 13, 2008 at 6:58 AM, Gregory M. [email protected]
wrote:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Yes, you’re right. On closer inspection, the JRuby StringScanner is
out-performing the MRI scanner; it’s the additional string processing
that I have around the scanner that is resulting in a much slower run
with JRuby. I’ll have to narrow this down.

// Gregory

Vladimir S. wrote:

provide a simplified benchmark that shows the problem.

JRuby have “native” implementations of StringScanner.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

What’s the additional string processing that slows JRuby down ?

Gregory M. pisze:

I’m not aware of any performance issues with StringScanner in JRuby.
–Vladimir

there are known performance issues in this area. It looks like both


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On the whole, my application is slower with JRuby 1.2. But when I
micro-benchmark each stage individually, the benchmarks show that JRuby
is faster. I think I need to look more closely at what the JVM is doing
when the application as a whole is running, this may in fact be a
resource issue.

// Gregory

Marcin Mielżyński wrote:

Vladimir S. wrote:

provide a simplified benchmark that shows the problem.

twice as


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email