Live data from Hacker News

Is Ruby Fast Yet?

isrubyfastyet.com

41–50 of 95 posts

Re: Is Ruby Fast Yet?

#41
post #38
post #35

[serious] I'm building http://techendo.co/ and it's running rails on heroku. I was wondering if there was some easy ways to get some better performance out of it immediately now that we're picking up traffic. If anyone could give me some pointers or link me to a page I'd appreciate it.

Going off the techempower benchmarks, looks like you should be able to get some speedup by switching to TorqueBox. No guarantees, but if you've got the time and need the performance it could be worth testing. Here seems to be a decent guide you could follow: https://gist.github.com/bbrowning/4296297

does it matter that I'm not using JRuby?

Re: Is Ruby Fast Yet?

#42

Wouldn't it make more sense to test various features of Ruby for comparison rather than comparing an entire web framework? Given that, the URL should be israilsfastyet.com, or more appropriately howdoesrailsbehaveonvariousrubyversions.com

If you test small features, you get knocked for concentrating on microbenchmarks which don't have any real-world meaning. If you test whole applications or frameworks, you get criticised for benchmarking that rather than the language implementation.

The criticism is with the name, not the features tested.

Re: Is Ruby Fast Yet?

#43
post #41
post #38

Earlier quoted context omitted.

Going off the techempower benchmarks, looks like you should be able to get some speedup by switching to TorqueBox. No guarantees, but if you've got the time and need the performance it could be worth testing. Here seems to be a decent guide you could follow: https://gist.github.com/bbrowning/4296297

does it matter that I'm not using JRuby?

You'd have to convert your gems over - you need jruby gems rather than standard ones, but apparently most gems are ported.

You can read up here for more:

https://devcenter.heroku.com/articles/moving-an-existing-rai...

http://stackoverflow.com/questions/151595/jruby-on-rails-vs-...

So it's not just a 5 second thing, but if you have a bit of time and need performance it's something you can try.

Re: Is Ruby Fast Yet?

#44
post #17

> The benchmark premptively runs the fans and pauses between runs in order to cool off. These measures give JRuby at least a 25% speed gain. However, JRuby still might be running slower than it would on a box with appropriate cooling. Right. Your computer can't be trusted to not throttle its performance due to crap cooling, and you're trying to benchmark using it?

The choice of hardware is quite strange. Should be fun to check the results on normal hardware though.

Re: Is Ruby Fast Yet?

#45
If I understand this correctly, this is running periodically on someone's Macbook; people are complaining that's a terrible platform for a benchmark.

It should be possible (if you care enough) to re-run this from the source control history on platforms of your choosing, across whatever date ranges you wish. Anyone really, really care enough?

Re: Is Ruby Fast Yet?

#46
post #23
post #8

JRuby question -- Why is it that much slower? I'd have thought that part of the point was to take advantage of the JVM's built in optimization.

A lot of optimizations are off by default, or completely unavailable because he's using JDK 1.6. See https://github.com/jruby/jruby/wiki/PerformanceTuning Startup time is slow because it needs to warm up the JIT. Same with Rubinius, which is mysteriously missing from most of these graphs. Memory consumption partially depends on how much you tell the JVM to use - it'll run the garbage collector more or less aggressive…

> Startup time is slow because it needs to warm up the JIT.

Question (I'll end up simultaneously googling...): if the code doesn't change between restarts, is there a way one can preserve JIT statistics, so the JVM doesn't have to rediscover hotspots? Like an RDBMS able to load custom statistics for its plan engine.

Re: Is Ruby Fast Yet?

#47
post #43
post #41

Earlier quoted context omitted.

does it matter that I'm not using JRuby?

You'd have to convert your gems over - you need jruby gems rather than standard ones, but apparently most gems are ported. You can read up here for more: https://devcenter.heroku.com/articles/moving-an-existing-rai... http://stackoverflow.com/questions/151595/jruby-on-rails-vs-... So it's not just a 5 second thing, but if you have a bit of time and need performance it's something you can try.

hm. I guess I'm not ready to switch to jruby.

Re: Is Ruby Fast Yet?

#48
post #36
post #18

Earlier quoted context omitted.

> EDIT: Also interestingly, JRuby seems to be slightly better on the small instance EC2 test at techempower than regular Ruby (small instance should be similar to a laptop?). Yet in these graphs it's much slower. Anybody know the reason? Thanks to some community experts, we're now using TorqBox (TorqueBox 3, built on Undertow [1]) for our JRuby tests. The JRuby community seems satisfied [2]. :) [1] http://torquebox.o…

Ah, that explains it. Pretty massive difference really. I guess that makes Torquebox+JRuby the best way to run ruby code? I wonder why the RoR community generally ignores it? Maybe it's just a timing thing and as more companies learn about Torquebox they will swap?

I'd wager that it's the TB/Undertow code running most of the time on that benchmark. On real-world benchmarks the difference is going to be a lot smaller. Not saying that you shouldn't run your JRuby apps on Torquebox - it's a great choice.

Re: Is Ruby Fast Yet?

#49
post #35

[serious] I'm building http://techendo.co/ and it's running rails on heroku. I was wondering if there was some easy ways to get some better performance out of it immediately now that we're picking up traffic. If anyone could give me some pointers or link me to a page I'd appreciate it.

That's an incredibly broad question, so it's pretty hard to answer. Here's some general ones:

* More instances will give you more requests/second, but only so long as secondary system (database, search server, whatever) can keep up with the load

* N+1 queries will kill your performance. They can add a lot of time to processing requests.

* Everything in the most used parts of your site should hit an index on the database. If it's not I can almost guarantee it will be slow.

* Look for work that you can move "offline". As long as they go out within a minute nobody will notice that you aren't sending emails at the exact time they are being generated. Move that work to a background queue so your web server can just add a queue entry and get on to the next request.

* Cache anything you reasonably can. It's a lot cheaper (i.e. faster) to read from a cache than to do a database lookup. It's cheaper to read from a cache than to render an ERB template. Caching can introduce its own difficulties, but the performance gains can be worth it.

Without knowing some specifics of your implementation I really can't give you better advice. Depending on the specific libraries you use it might not even be possible to move to JRuby due to support for C extensions. You might get some performance benefits out of it, but I'd expect it to only buy you some time to execute on some of the above improvements.

Post reply on HN