I think that all the metaprogramming magic that Ruby allows is at odds with speed. That is not to say that it's impossible to make it fast, but it's probably tricky.
I don't think so, Java and C# also have metaprogramming (reflection, class loading, bytecode manipulation) and they are still plenty fast.
Ruby's liability is that it's dynamically typed, and this puts a hard limit on how fast it can be (and also on how toolable it can be, but that's a separate discussion).
Lisp + Scheme: I mean if nothing else, people have been trying to make them fast for the last more than half of century. Plus AFAIK most Lisp meta-programming code is generated during compile time through macros not during run-time.
Dylan: I don't really know anything about Dylan but it seems to have come out of Apple and CMU, so there's that. Plus it seems to be just a Lisp dialect.
Smalltalk: You consider Smalltalk fast? Lol.
Well, any Smalltalk JIT beat the standard Ruby implementation hands down, what can I say?!
If you do a lot of reflection in Java then you'll end up with some pretty crummy performance, but the average Java program doesn't have much.
That said, JavaScript is not far off of Ruby's monkeying capabilities and yet pretty darned fast.
Well, Javascript allows almost as much metaprogramming (and with ES6 proxies and such, exactly as much).
b.) It also has Google pumping a LOT of resources into making it fast.
OTOH, grep for instance_eval and class_eval in rails source.
> OTOH, grep for instance_eval and class_eval in rails source.
I mean what's your point. Yes, I realize that both are used profusely, which is one of the things that this discussion is about.
I didn't describe metaprogramming, just how I usually see common metaprogramming "magic" implemented in javascript. The only reason you'd really need eval in js metaprogramming is if for some semantic reason it was nicer to accept a String of javascript somewhere. Afaik eval doesn't "get" you anything in javascript (it doesn't "unlock" private closures scope or anything, and context-injection is available using #call or #apply) and I almost never see it used, unless I am forgetting something (totally possible, I've been up all night)
> I mean what's your point. Yes, I realize that both are used profusely
My point is I don't see eval used profusely in javascript, which contradicts your assertion in a).
Edit: nvm, I stand corrected: (function(){var x = 1; eval('console.log(x)'); })() prints 1. Neat. But still, I do not see this often used, the callback + context passing approach is much more common.
For a while Phusion offered Ruby Enterprise Edition[1] which made improvements on the Ruby 1.8.7 interpreter including improvements such as:
> * A “copy-on-write friendly” garbage collector, capable of reducing Ruby on Rails applications’ memory usage by 33% on average.
> * The tcmalloc memory allocator, which lowers overall memory usage and boosts memory allocation speed. > * The ability to performance tune the garbage collector.
> * The MBARI patch set, for improved garbage collection efficiency.
> * Various analysis and debugging features.
They've since dropped support of it because:
> * A copy-on-write patch has recently been checked into Ruby 2.0.
> * Many of the patches in Ruby Enterprise Edition are simply not necessary in 1.9.
So it sounds like many of the improvements offered in Ruby Enterprise Edition 1.8.7 have been rolled into Ruby 2.0. Do you have any suggestions of what might be included in a Ruby Enterprise Edition 2.0?
[1] http://blog.phusion.nl/category/ruby-enterprise-edition/
There will be no Ruby Enterprise Edition 2.0. REE has been discontinued.
The original goal of REE was to incorporate our copy-on-write friendliness patches into Ruby, and to distribute it in a user-friendly form. Since then, its goal has been extended to include other useful patches as well. We've discontinued Ruby Enterprise Edition for the following reasons:
1. Ruby 2.0 incorporates (or obsoletes) all these improvements.
2. Ruby 1.8 is no longer supported even by its upstream authors.
3. We have limited resources and wanted to focus on Phusion Passenger. Since the discontinuation of REE we've made tremendous improvements in Passenger.
The plan was to hand over maintainership to another interested party. Unfortunately nobody volunteered. http://blog.phusion.nl/2012/02/21/ruby-enterprise-edition-1-...
Even Twitter went public recently and posed to challenge big guys such as Google, Facebook, they've lost my respect as a technology company.
I don't accuse them of not saving the world, but Ruby and Rails lost a great opportunity to dominate the web community. If Rails were as performant as Node.js, I doubt lots of companies would change gears.
They didn't lose this opportunity because of Twitter, they lost it because the fact that Ruby is dynamically typed puts a hard limit on how fast it can be. Twitter tried very hard to make it scale before making the decision to switch to Java, and they just couldn't do it.
The task was just impossible, switching to Java was the only reasonable decision given their constraints.
Seems that node.js outperforms the JVM for WebDev nowadays.
And language benchmarks don't tell the whole story. In Java, idiomatic and typical code will be optimized very well whereas in Javascript such code runs easily at least an order of magnitude slower than its potential. Try to run some idiomatic JS through https://github.com/petkaantonov/nodeperf/ and see it explode :)
So even if Javascript can be shown in some benchmark to close on the JVM, the benchmarks are ignoring the fact that you cannot write Javascript carelessly to get anywhere near those speeds unlike with Java.
Are you aware that Hotspot, Sun/Oracle's JIT compiler was actually developed for a Smalltalk dialect, Self?
Actually, they escaped to the JVM, and if their job reqs are any indication, they hire massively for Java engineer positions and hardly at all for Scala ones.
I wouldn't call that chickening out, more common sense.
Rails is great for prototypes and toy apps, but once you start needing scale, it's simply not up to the task.
This gets said here a lot. What about GitHub and Shopify, and ...? Are those toy apps?
[1] http://www.slideshare.net/jduff/how-shopify-scales-rails-204...
You seem to imply Ruby's/Rails' speed matter?
Usually, the DB is the limiting factor in most web applications, few should need to execute more than a few milliseconds of (even) Ruby per page load. That is why people use scripting languages, after all.
Shouldn't this slowdown be a problem in the ORM for this version? I'd look at access patterns for normal requests for the new Rails version and the old. How has the SQL changed?
Sure, Twitter is different since that probably is processor bound.
(Since RoR is a popular framework with lots of eyes, there shouldn't be something simple with e.g. configuring the web server, locking etc.)
*From an episode of Ruby Rogues with Zach Holman
But they didn't magically make Rails fast, so screw them?
Dynamic webpages consisting of several widgets are quite amenable to parallelization by rendering subviews separately and just assembling them in the layout in a final step. With parallelism slow single-threaded performance can still yield reasonable response-times if you can throw multiple cores at the problem.
But even if you have parallelism, a slow single-threaded GC would halt all of those threads, again affecting your response times.
I don't know about V8, but mozilla's JS is suffering from similar issues. They're currently working on generational GC and it's promising to provide quite some speed-up. But the javascript runtime, just like ruby, was not designed with parallelism in mind, that's why we're seeing those webworkers which essentially spawn an isolated javascript environment. Simply because it's hard to tack on parallelism as an afterthought.
Similarly one of Ruby 2.1's major performance boosts stems from the generational GC.
Charles ominously called "dark matter" inside rails.