tags:

views:

116

answers:

1

I've just noticed that a lot of hpricot code is written in java...

alt text

I heard that JRuby performed a lot better than native ruby when processing regular expression. Is maybe the java classes just activated if JRuby or Java is installed and the ruby used if these are not found?

It's something puzzling indeed.

Thanks

+1  A: 

Ruby gems can be written in pure Ruby, or have native extensions. In that case, they may have a C extension and/or a java extension. When installing on Ruby MRI and Rubinius, the C extension (and only the C extension) will be used. When installing on JRuby, the Java extension (and only that one) will be used.

hpricot has both, to be compatible with all of these major Ruby implementations.

Marc-André Lafortune
In that case hpricot would not be more compatible but would have more requirements (JVM and platform dependent C binaries)
Pablo Fernandez
Oh! and (unrelated): The art you present in your website is **AWESOME** man! nice work!
Pablo Fernandez
@Pablo: You use either the Java extensions, *or* the C binaries. It's either/or, not both.
Andrew Grimm
@Andrew Thanks for making that clear
Pablo Fernandez
@Pablo: thanks :-) I made my answer even more clear that the extension used depends on where you are installing it.
Marc-André Lafortune
@Marc-André "Ruby gems be written in pure Ruby" - Is this talk like a pirate day? :) Also, do you mean "a java extension" rather than "in java extension"?
Andrew Grimm
@Andrew: yarrr! :-)
Marc-André Lafortune