Concurrent threads using magic regexp vars like $1 stomp all over each other, quite nasty: https://github.com/jruby/jruby/issues/3031 Stumbling over a serious race condition in the first 5 minutes of trying it with real code makes me a bit wary. All the performance in the world isn't much good if it's randomly wrong :/
You really shouldn't be relying on globals anyway. Using $1 etc. is a serious code smell. It shouldn't by definition be threadsafe in any event. The only way that would work would be if you rely on the threads not actually running at the same time as an implementation detail of the MRI.
JRuby 9000 released
61–70 of 119 posts
Re: JRuby 9000 released
#62Earlier quoted context omitted.
You really shouldn't be relying on globals anyway. Using $1 etc. is a serious code smell. It shouldn't by definition be threadsafe in any event. The only way that would work would be if you rely on the threads not actually running at the same time as an implementation detail of the MRI.
$~ and friends are not global: def f p $~ # => nil "123" =~ /\w+/ p $~ # => # end p $~ # => nil "abc" =~ /\w+/ p $~ # => # f p $~ # => #
Re: JRuby 9000 released
#63Earlier quoted context omitted.
There's a pure-Java fallback that has most of the same functionality. But if you wanted precise POSIX function calls you probably weren't running on App Engine anyway.
Have you tried the pure-Java fallback on App Engine? I tried it for JRuby 1.7 and it didn't work. I haven't tried yet with 9000, have you?
Re: JRuby 9000 released
#64Earlier quoted context omitted.
As far as I'm aware, the port of pg 0.17.1 is alive and well: https://github.com/headius/jruby-pg
Is there any guidance out there about when to use activerecord-jdbc-adapter vs this gem (for postgres)?
Re: JRuby 9000 released
#65Earlier quoted context omitted.
Currently, there's $1700 in store for whoever does support it: https://www.bountysource.com/issues/5831191-tasks-to-finish-...
Yep, I've put up money for it myself, and regularly be on twitter for other folks to do the same. I wish a big company that uses jRuby would step up and support the tools they use :/
Re: JRuby 9000 released
#66Earlier quoted context omitted.
No, its just a drag to TDD with.
I and others have had success with MRI on dev and JVM in prod to get around this. Maybe not for everyone but as long as you know what you are doing it is viable I think.
Re: JRuby 9000 released
#67Earlier quoted context omitted.
The same bug still exists in JRuby 9000, and was in fact the first thing I ran into when trying it. Considering threading is the main selling point, one of the commonest patterns of regexp use being completely and dangerously broken with them would have seemed like something of a showstopper.
Ah, I didn't get that from your original post. So JRuby 9000 shipped with a known concurrency bug that, from the face of it, seems likely to be a problem in actual use. I agree that seems a bit worrying.
Re: JRuby 9000 released
#68JRuby is a great idea. It has one pitfall which consistently stops me from using it though : poor support with newer releases of Rails, usually due to the Active Record stack not working well with the AR JDBC adapter. I know some work was being done on a JRuby version of the standard pg gem (without the need for JDBC) which would be fantastic if it was completed and working.
Re: JRuby 9000 released
#69is it faster than MRI?
That depends on what you mean by faster. For CPU-bound work, JRuby is almost always faster. The JVM is very good at optimizing. However, the best performance doesn't kick in until the JVM is sufficiently warmed up, which means JRuby shines mostly for long-running tasks. Warming up can take a few minutes, although some people tell me that I should warm up for half an hour (!). On the flip side, JRuby starts much more…
We continue to try to improve startup performance, and hopefully over the next year we can close the gap a bit more.
Re: JRuby 9000 released
#70is it faster than MRI?
JRuby used to be much faster than MRI (definitely so when MRI 1.8 was current), but MRI has gotten better faster than JRuby, and IIRC, its now mostly a mixed bag based on workload, particular application design choices, etc.