views:

249

answers:

4

We're convincing our Products officer that we want to use JRuby on Rails, and we're having a hard time coming up with some statistics which show that:

  1. Coding time is less using Rails vs. say Struts or Zend Framework or what have you.
  2. Ruby (and JRuby in particular) performance isn't horrible (anymore).
  3. Rails performance isn't bad either.

If you can get us some good stats quickly, we might have a chance!

Update:

We actually did convince the business to use JRuby on Rails, and we're a few months into the project now. Thanks for your help!

+1  A: 

Pretty hard question to provide concrete information. Performance really depends on your app's use-cases and architecture.

I would suggest you whip up different versions of a particular use-case and measure performance. It could be a quite simple view that hits the database and renders the page. Use the same DB structure.

The irony of the whole argument is that PHP isn't the fastest thing on the block either. In non-trivial apps you need to start adding an Accelerator to cache your bytecode. The JVM has incredibly advanced support for this kind of stuff. The Rails architecture, being based on an app-server approach gets around a lot of this because you actually have an application-wide memory scope (PHP needs to parse and render everything on each pass).

Anyway, from my own experience, I have used PHP since 2000, moved to Rails several years ago back in the pre-v1.0 days) and have large systems in production using both.

  • I have found that Rails is much faster to develop in. I have found it up to 50% more efficient, depending on the feature. As in, I can develop in half the time.
  • I have production Rails systems with heavy database usage that render in 200-300ms.
  • The Rails ecosystem is these days much further ahead of PHP when it comes to support for all of the ancillary systems and processes required for good software engineering. There is no coincidence that libraries like Cucumber and rSpec have evolved in the Ruby world.
Toby Hede
>> As in, I can develop in half the time << Compared to which PHP or Java framework?
igouy
+2  A: 

It's hard to quantify 1 even when it's clearly true. A poor measure but the best I can come up with is the comparative gzipped size of the code:

http://shootout.alioth.debian.org/u64/benchmark.php?test=all&amp;lang=yarv&amp;lang2=java

The ruby code contains half the "information" of the Java code. I've done a few years of rails, and plenty of other frameworks, but it's near impossible to quantify, since I've never written the same project in two languages/frameworks.

The one thing that isn't accounted for in the graph though is that Ruby can't have compiler time checking, so you generally have to have better test coverage in order to have confidence in the code you're deploying.

  1. Ruby performance has come leaps and bounds in terms of performance. It's still bad when you compare it to just about anything, but for a web front end, it honestly doesn't matter that much. JRuby is faster than Ruby (1.8.x) but still an order of magnitude away from a statically typed JVM language (scala/java etc).

  2. Honestly, Rails is damn slow for a framework. The computational heaviness helps allow an insane rate of development though. For a front end, it doesn't really matter that much either.

Your front end framework/language choice is only going to add maybe 10s of milliseconds to each request. If you your app does anything significant with data at all, the front end presentation/calls aren't going to take the majority of the request time.

It's pretty much all about trade offs and what does/doesn't matter. Computational speed of your front end language honestly isn't that important, and the productivity boost of a "slower" language such as ruby generally outweighs the things you give up.

Michael
>> It's hard to quantify 1 even when it's clearly true << In which case, "it's clearly true" seems all assumption without evidence.
igouy
>> A poor measure but the best I can come up with... << You haven't explained why anyone should believe less code means less coding time. On the contrary, the joke has long been - "I did not have time to write you a short letter, so I wrote you a long one instead."
igouy
igouy
On the first 2 comments: "Assumption without evidence"? Really? Would you rather code in machine code or a high level language? Surely it's easier to write machine code since it's longer (according to your joke). The merits of a higher level of abstraction are fairly self evident, when the abstraction fits.
Michael
Third comment: On the JRuby front, I'm a bit out of touch, I was just using the old 1.8.x stats. Apparently 1.9 is ahead by a significant cut these days, will edit my post.
Michael
>> The merits of a higher level of abstraction are fairly self evident << You haven't pointed to anything that shows those languages are at different levels of abstraction, at most it might suggest faster programs tend to be less abstract. More to the point you haven't point to anything that shows "Rails vs. say Struts or Zend Framework" are at different levels of abstraction.
igouy
>> Surely it's easier to write machine code since it's longer (according to your joke). << No, it's about what we don't know. We don't know how much time was spent making the high-level program short, or how much time was not spent making the machine code short.
igouy
This isn't LTA or a paper, a bit of prior knowledge can be assumed. You're completely absurd, and it's not worthy my time.
Michael
Thank you for your answer, everyone gave good ones, but I really appreciate the actual stats you found. Any stats would be used for persuasion. Our application isn't going to be doing anything extremely resource intensive.
thekingoftruth
+2  A: 

If you want to bet PHP code by Rails in terms of raw speed, forget it.

Business decision concerns more than raw script speed, namely:

  • interoperability, how well your new app will fit in the corporate app environment
  • continuity, how many other staff knows (adopts) rails like you and how likely you can recruit more if there is none, what if you are gone, say, 3 months later?
  • security, more than how secure rails is, also concerns how fast any issues can be fixed, who will fix that
  • reliability, recovery .. etc.

and you have more to concern:

  • deployment, mod_rails is here, but it's still not straight forward as php, you have need admin team's commitment
  • scalability, probably won't be concern, when you have as much traffic as tweetie, you will get the budget to rebuild it ;-)

we know we all love rails. many still don't. let's go preaching ;-)

ohho
A: 

Well, there are Lies, damned lies, and statistics.

The problem with your question, is that it's neigh impossible to answer out of context. Ruby is generally not a particular fast language, but it totally depends on what you are doing. Why do you want to use speed as a measure of quality? Is your application doing something that is very resource intensive?

Regarding development time, I would say that Rails is a proven stack for rapid development. But so is PHP. Which is the better choice, depends a lot on the programmers.

troelskn
After all, facts are facts, and although we may quote one to another with a chuckle the words of the Wise Statesman, 'Lies--damned lies--and statistics,' still there are some easy figures the simplest must understand, and the astutest cannot wriggle out of. Leonard Henry Courtney, 1895
igouy