Settings

Theme

"Ruby isn't slow. If anyone tells you PHP is faster than Ruby, tell them: 'Benchmark it.'"

skitch.com

19 points by pius 17 years ago · 30 comments

Reader

charlesju 17 years ago

Maybe I'm slow but it seems to me that the language is never the bottleneck for web applications. It seems to me that the bottleneck is in the db which is language agnostic for all general purposes.

And anything that is slow with just Ruby can be solved by throwing money at it.

  • jlouis 17 years ago

    Thoughtful and correct IMO. Caching is much more important to get right than backend-speed. Number crunching capability does not matter that much for web applications. And you can always outsource the tough calculations to languages better suited for it: ML, Common Lisp, C++, C, etc.

  • jamongkad 17 years ago

    True I think another bottleneck would be the web server serving the pages. Albeit a distant one as compared to the DB. What I don't get here is what is everyone's obsession with speed and shootout contests. What gives? I think we as developers have to focus on the bigger picture.

    To build apps that our users will love.

    No matter the language, framework, or whatever. If we miss this point which is a very crucial point for that matter. Then all of our optimizations are for nothing.

jacobbijani 17 years ago

Oh, god. How many times does this point need to be made? Yeah, cool. The compiler is fast.

Probably 1% of all websites on the internet ever manage to get enough traffic to make the language matter, right?

  • kaens 17 years ago

    To be frank, at this point in time when I'm developing for the web, just about the only thing I care about when it comes to what language I'm using is that it's not PHP.

    I understand why people use PHP, but as someone who has a decent amount of experience with a variety of languages, I really want a language that's designed sanely, especially for things like web-(sites|apps). I'll gladly take a hit on the language-speed side, or on the ease-of-finding-hosting side for the sake of not having to put up with PHPs craziness.

    Why? For just the reason you pointed out - the vast majority of websites don't get enough traffic to make the language matter. I'd imagine that things like learning how to configure apache and/or a caching tool like memcached would handle most of the performance bottleneck on a site that did get that level of traffic.

    Seriously - if a language is "fast" enough to allow the creation of responsive GUI apps, it's "fast" enough for web-apps.

    • neovive 17 years ago

      PHP might not be the most elegant in the world, but for a small- to mid-size web application, using a solid PHP5 framework (like KohanaPHP) along with a PHP accelerator and you have an easy-to-use and easy-to-deploy application.

      • kaens 17 years ago

        I agree in general, it's just not for me.

        For small to mid-size web apps, I far prefer python and cherrypy (http://www.cherrypy.org). Easier to use, and easier to deploy assuming you have hosting that gives you control over your hosted machine (here's looking at you, slicehost).

sfamiliar 17 years ago

quite a few newcomers come to rails and think it's slow, because they're 'doin it wrong'. every framework's speed is really about your deployment setup. running mongrel can be slow, especially if you're load-testing a single mongrel instance. multiple instances can be slow if they're connecting to a slow database and serving static files.

put nginx in front of thin, start caching frequently used objects, and slice up your database and suddenly speed isn't a problem. php has the (perceived) advantage of running compiled in an apache module, typically. but it's a perception -- you have to do a little more tuning with your rails deployment to make it scream, but make no mistake, it can scream, even under heavy load, and without a huge server farm, at least up to 500K pages/day. i know that number because i've served it. quickly.

in radiant. (gasp! yes, with some caching.)

with one database.

it's a lesson i learned working with tomcat back in the day: defaults suck. learn your framework, learn your app server, pick the Right Thing. it's all about application tuning and app-server choice, and that goes for every language and platform in existence.

piusOP 17 years ago

The headline is a quotation from Yehuda Katz's MerbCamp closing keynote. See the summary of the keynote here at the bottom of this link:

http://rubypond.com/articles/2008/10/12/merbcamp---day-2/

rlachenal 17 years ago

Translate please -

http://shootout.alioth.debian.org/gp4/benchmark.php?test=all...

  • silentbicycle 17 years ago

    The white bars are time, the black bars are memory usage. Ergo, in most cases, PHP is running 2-5x faster than Ruby, but using about 3x as much memory.

    • jlouis 17 years ago

      Memory usage can probably be attributed to how PHP manages memory (hint: It /almost/ doesn't).

      • silentbicycle 17 years ago

        Right.

        Outlying results have to do with that whatever that specific benchmark concerns, e.g. thread startup cost.

        • igouy 17 years ago

          > e.g. thread startup cost

          There are 2 which require threads, there's no PHP program for either of those so why do you think "thread startup cost" has any relevance?

          • silentbicycle 17 years ago

            I wasn't stating which the outliers test, I was saying how to read the graph.

            • igouy 17 years ago

              If that was your intention it's strange that as an example you suggested something that is not shown on the graph.

    • igouy 17 years ago

      > in most cases

      In 9/15 cases PHP is >= 2x faster In 6/15 cases PHP uses less memory

      • silentbicycle 17 years ago

        Thanks for being so pedantic for us. We understand how valuable your time is, and it's quite flattering that you chose to spend it on catching and correcting microscopic ambiguities in our discussions that might have otherwise gone undiscovered.

        • igouy 17 years ago

          Thanks for offering help to rlachenal.

          As the webpage states "a white bar shows which language implementation had the better time, and a black bar shows which had the better memory use".

          More flattery - in context "most" is not ambiguous, it's vague.

          As you are saying how to read the graph, a specific example will be more helpful than a vague summary.

  • igouy 17 years ago
  • igouy 17 years ago

    What don't you understand?

zinxq 17 years ago

If you're comparing something to PHP's speed, you've already lost.

drawkbox 17 years ago

...and Python is still 3x faster than PHP and Ruby without psyco..

omouse 17 years ago

You can also say "Smalltalk isn't slow" or "Lisp isn't slow", but you won't see anyone run towards either of them...

markbao 17 years ago

Stats for Rails?

  • piusOP 17 years ago

    "Next was comparing Merb against other ruby options. Returning directly from the Merb router kills everything, but there aren’t many scenarios you could use that. Sinatra is just slightly faster than returning from the Merb controller, which both outperform Rails by a 3-4x. Rails itself still kills CakePHP."

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection