New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JRuby support #21
JRuby support #21
Conversation
Thanks heaps @headius Do you mind adding this to .travis so CI runs it and making sure |
Taking a step back here, do we even need this micro-optimisation in jruby? in cruby the implementation 2-10x faster but in JRuby, who knows. Maybe simplest is just to tell this to use a Ruby implementation in JRuby which makes distribution easier |
@SamSaffron Yeah that's a good point, let me do some investigation. |
Ok...so we certainly run these things faster than MRI, but not as fast as the native implementation currently. I also added a "medium_blank?" using
Compared with MRI 2.4.1:
So every case is faster than MRI (which isn't really surprising). However, the biggest thing fast_blank does for all of these impls is eliminate all the garbage created by the pure-Ruby versions. A short term fix would be to release a jruby version of the gem that just uses the fastest valid Ruby impl. It could either be a However, we'd still get the best perf out of an ext, unfortunately. |
This commit has no build smarts. Here's the process: ``` $ javac -cp ../jruby/lib/jruby.jar -d ext/java ext/java/com/headius/jruby/fast_blank/FastBlankLibrary.java $ jar cvf lib/fast_blank.jar -C ext/java/ com $ jruby -Ilib -e 'require "fast_blank"; p "".blank?' true ``` Proper support will use `rake-compiler` to build the jar.
I've pushed an update to this in an effort to get it out of my queue... this gem still does not install on JRuby, so having pretty much anything would be better than that. Updated performance comparison with CRuby 2.7: JRuby:
CRuby:
|
I am fine with this, but we need to redo the gemspec and add instructions on how to publish the jruby version. |
This PR tracks JRuby support.
I ran into this library in use by Mastodon. Unfortunately, there's no JRuby version.
After looking at the codebase it was obvious this was a 10 minute job. Naturally, it took me 30 minutes. But here it is.
I have not included any logic to build the jar. We could use one of the JRuby-friendly compile plugins for Rake, or just script the simple process: