Slashdot Mirror


Experimental MacRuby Branch Is 3x Faster

An anonymous reader writes "Zen and the Art of Programming published an article about MacRuby's new experimental 0.5 branch (project blog entry here). According to the included benchmarks, Apple's version of Ruby could already, at this early stage of its development, be about three times as fast as the fastest Ruby implementation available elsewhere."

48 of 191 comments (clear)

  1. That's because it's spiked with assembly by Anonymous Coward · · Score: 5, Funny

    I heard it made a guy in Michigan's head explode! That's why I stay away from the experimental stuff, man.

  2. Why MacRuby Matters? by Anonymous Coward · · Score: 4, Insightful

    Why MacRuby Matters (Present & Future)?

    Apparently because an experimental incomplete version of Ruby is fast. Colour me unimpressed.

    1. Re:Why MacRuby Matters? by NoTheory · · Score: 4, Insightful

      MacRuby matters for a lot of reasons. Early benchmarks aren't one of them. http://blog.headius.com/2009/03/on-benchmarking.html

      MacRuby's potential for Cocoa integration is fantastic and great, and something i very very much want to see.

      It's not clear however what relationship benchmarks at this stage (with an incomplete implementation) will actually correspond to in the future. They are a total red herring for discussion.

      Look at MacRuby on the merits! not the benchmarks!

      --
      There are lives at stake here!
    2. Re:Why MacRuby Matters? by Artuir · · Score: 5, Funny

      Whenever I read posts like these I start to wonder if I accidentally walked into a Starbucks.

    3. Re:Why MacRuby Matters? by thePowerOfGrayskull · · Score: 4, Funny

      I suspect that someday in a future version of the Mac OS, Ruby will be a first-class language for application development alongside or perhaps replacing Objective-C.

      Wouldn't that require Ruby being a first-class development language in the first place? ;)

      Yeah, yeah, go on and mod me troll, I can handle it.

    4. Re:Why MacRuby Matters? by tyrione · · Score: 5, Insightful

      Well, if you ask me, I suspect that someday in a future version of the Mac OS, Ruby will be a first-class language for application development alongside or perhaps replacing Objective-C. I think Apple likes Ruby and its aesthetic. A lot of the Rails devs are Mac developers, and I think that's where it sparked.

      First Class, maybe. Replacing ObjC? You're prediction makes LSD trips seem dull.

    5. Re:Why MacRuby Matters? by Macthorpe · · Score: 5, Funny

      Yeah, yeah, go on and mod me troll, I can handle it.

      Alright then!

      Wait a minute...

      Shit.

      --
      "It does not do to leave a live dragon out of your calculations, if you live near him." - Tolkien
    6. Re:Why MacRuby Matters? by Anonymous Coward · · Score: 2, Insightful

      Whenever I read posts like these I start to wonder if I accidentally walked into a Starbucks.

      Yea, these Mac snobs need to get with the program. If they put half the effort they put into MacRuby into CocoOnPunchCards, perhaps the rest of us might take them a little more seriously.

    7. Re:Why MacRuby Matters? by Anonymous Coward · · Score: 2, Funny

      This is slashdot. Benchmarks are all that matters.

    8. Re:Why MacRuby Matters? by Malevolyn · · Score: 3, Funny

      Don't forget the possibility of ObjC extensions for Ruby.

      --
      Your ad here.
    9. Re:Why MacRuby Matters? by Teilo · · Score: 3, Insightful

      I don't care much for Ruby myself. I'm a Python guy, but I don't give a frack what language people use.

      "Least used scripting language"? Right, because nobody develops on Rails (like it or hate it).

      Ever check the stats on Developers who use Macs (vs. the general populace)? Didn't think so.

      And finally: that which makes MacRuby very very fast can also make Ruby on *nix very very fast.

      The problem with Ruby is not the language. It is the VM. Improve the VM, and more people will look at other uses where Ruby is a great fit but for its speed.

      --
      Mir tut es leid, Menschen daß Einfältigfehlersuchenbaumfolgendenaffen sind.
  3. And... by Creepy+Crawler · · Score: 2, Informative

    Of course, Slashdot is a dime short and days late on the real news.

    JavaScript 3-10x Faster On iPhone OS 3.0

    Well, for a better, no BS news aggregator, try The Hacker News. Then after seeing it there for a few days, come to slashdot to see a regurgitated discussion.

    --
    1. Re:And... by iamhigh · · Score: 2

      Yeah, a site of links really compares to the discussion system here on /.. The discusssion and moderation system are what make this site good. Everyone but the dumbest of fucks knows that.

      --
      No comprende? Let me type that a little slower for you...
  4. LLVM strikes again. by jcr · · Score: 2, Interesting

    This is great news. The work that Apple's doing on LLVM is a renaissance in compilers.

    -jcr

    --
    The only title of honor that a tyrant can grant is "Enemy of the State."
    1. Re:LLVM strikes again. by samkass · · Score: 5, Interesting

      Of course, the results don't exactly show a "3x speedup"... they show between a 0.08x speedup and a 7.8x speedup, with a high variability. Which is really great for such an early build, but it's not an instant panacea for everything.

      --
      E pluribus unum
    2. Re:LLVM strikes again. by TheRealMindChild · · Score: 2, Interesting

      You know. It was bad enough when we had multitudes of acronym collisions with 3-letter acronyms... but did anyone else associate LLVM with Linux Logical Volume Manager?

      *sigh*

      --

      "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
  5. Yeah , a true renaissance by Viol8 · · Score: 4, Insightful

    "LLVM supports effective optimization at compile time, link-time (particularly interprocedural), run-time"

    Amazing, truly unique ideas. If only someone had thought of doing this 30 years ago... oh wait...

    1. Re:Yeah , a true renaissance by bonch · · Score: 2, Interesting

      The greatness of LLVM and Clang is that they replace the slow, rigid, crumbling GCC codebase. When the BSD-licensed Clang hits ready status, expect a massive switchover.

  6. Painted red by EdZ · · Score: 2, Funny

    Those new code contributions by Mr Aznable made all the difference.

  7. Re:The questions remains... by FooBarWidget · · Score: 5, Insightful

    Every time a story is posted about Ruby performance improvements, someone will post something along the lines of "x times faster than super ultra duper slow is still slow". Even if Ruby is 1000 times faster, there will still be people complaining. My guess is that none of these people actually use Ruby in production to be able to tell how much interpreter performance actually matters in the grand scheme of things.

  8. Re:Ruby? by NoTheory · · Score: 4, Insightful

    Er, way to troll? If you'd like to do your ridiculous hello world you can stick to:

    puts "i like beans"

    And it's really unclear what "it" you're referring to. Because Ruby, for me, is a good blend of the things i wanted from Perl and Lisp with a side of Object Orientation. I get all the laziness and conveniences of Perl, and i can do all the crazy stuff i'd want to do with Lisp. So imo, you're way off base.

    --
    There are lives at stake here!
  9. Nitro AKA Squirrelfish by stefaanh · · Score: 3, Interesting

    I wonder if this has any connection to what they learned creating the optimized javascript "interpreter" they made for their next generation rendering engine Webkit.

    --
    --------
    * Sigh *
  10. true, but seems unnecessary by Trepidity · · Score: 2, Informative

    Common Lisp is ultra-dynamic and whatnot and still compiles to machine code, which in some implementations (SBCL/CMUCL) is quite respectable in performance. Is there something inherently less-compilable about Python, Ruby, Perl, etc., or have they just not had the same engineering work put into them?

    1. Re:true, but seems unnecessary by cryptoluddite · · Score: 2, Informative

      Common Lisp scores really well on benchmarks because they turn off all the safety protections that are most of the reason to use a dynamic language in the first place.

      All scripting/dynamic languages are slow, and they always will be because nobody wants a really high level language that crashes.

    2. Re:true, but seems unnecessary by Cyberax · · Score: 2, Interesting

      LISP compilers are not magical. They just try to:
      1) Infere types and then compile typed code.
      2) Do inlined threaded interpreter for everything else.

      I.e. if you want fast LISP code - you have to write it like you would write it in C/Java/C++/another_static_language.

    3. Re:true, but seems unnecessary by Trepidity · · Score: 2, Interesting

      It scores pretty well even if you don't turn them off, because the good compilers (mainly CMUCL/SBCL) have type inference that can determine at compile time a large subset of the cases where it's safe to elide the runtime checks.

    4. Re:true, but seems unnecessary by Tumbleweed · · Score: 4, Funny

      PS: Do you want me to punch you in face? You see, C++ is one of my favorite languages :)

      I don't like the feeling of being punched in the face, which is one of the big reasons I don't code in C++ or Java. But if that's your thing, you should keep at it! :)

    5. Re:true, but seems unnecessary by ChunderDownunder · · Score: 2, Informative

      Who mentioned programming Java? Only your fouled-mouthed troll.

      Cyberax was talking about running languages such as Python, Ruby or Lisp on the Java Virtual Machine. In turns out that many of the runtime techniques within HotSpot to speed Java can also be used to optimise the performance of others. Where not the case, special mechanisms are being added to bytecode to create a truly language independant VM.

      Thanks to Red Hat, there's also an LLVM based backend for HotSpot in development, Shark.

  11. Re:The questions remains... by wrook · · Score: 5, Interesting

    I agree with this totally. These days I'm writing exclusively in Ruby and it is "fast enough" (even with 1.8.X). In fact, this speed issue is such a big red herring for me. I hardly ever have any issues with speed. Instead I spend most of my optimization time trying to cut down on memory usage.

    For me, even an order of magnitude difference in speed (i.e., 10X) isn't going to mean too much. There are certainly places where I'd like my code to be faster, but they are very, very small places. I can easily code them in C if I have to (C/Ruby bindings are *very* easy to write). But honestly, I've never gotten to the point where a speed improvement is more important than a functionality improvement. Every program is different, of course. So not every problem is suited to Ruby.

  12. How they did it by Anonymous Coward · · Score: 5, Funny

    Sleep(30); /* used to be 90 */

  13. Re:The questions remains... by 33degrees · · Score: 3, Informative

    While the Ruby 1.8 VM is quite slow, the YARV VM used in 1.9 is much faster, resulting in similar performance to most other dynamic languages. These tests are showing MacRuby being 3x faster than 1.9, which puts it in "quite fast" territory.

  14. This sounds great! by Anonymous Coward · · Score: 2, Funny

    But I'm a heterosexual so I will not be able to take advantage.

  15. Re:Your sig by Creepy+Crawler · · Score: 2, Informative

    Thanks ;)

    You'd be surprised of the multitudes of comments I get on me and my bastardly signature... Well, you could always look at my freaks list to get an inking.

    I thought it was rather dryly funny.

    --
  16. GCC avoids high level interprocedural optimization by Pinky's+Brain · · Score: 2, Interesting

    Because they don't want to expose high level intermediary code (too easy to hijack part of the compiler into a closed source project). Or at least that was one of the reasons LLVM was rejected for next generation GCC at the time.

    They might have changed their mind now LLVM is bearing down on them ...

  17. Re:Ruby? by anegg · · Score: 3, Insightful

    Any sort of layering is a major cause of bugs/slowdown? Quick, throw out TCP/IP. Everyone start using Ethernet frames directly from their apps, even if what you really want to use is SOAP over HTTP over SSL over TCP over IP... I'm not sure how you will get your Ethernet frames past the first router, but I'm sure you will think of something. Damn layering just gets in the way!

  18. Apple is not Microsoft ... by Pinky's+Brain · · Score: 2, Insightful

    They don't have any particular antipathy to the GPL ... Chriss Lattner proposed LLVM as a GCC successor after starting work at Apple. The FSF kicked him to the curb. I don't know if they underestimated his and Apple's commitment into turning the compiler into a true competitor or if they are simply stupid.

    As LLVM gets better GCC will lose developers, this is unavoidable, it's EGCS all over again ... but this time a merge doesn't seem on the cards. It wasn't LLVM but the FSF themselves who torpedoed one of the GPL flagships ... and for very very poor reasons.

  19. Re:Ruby? by rgravina · · Score: 2, Insightful

    So you're suggesting that instead of creating languages like Ruby, we should create libraries to more complex environments like Java to make them faster to develop with? Variety is the spice of programming :). Personally, I'm glad languages like Python and Ruby exist and they are not only great and productive languages, they have both made me rethink the way I write software. I'm not sure just adding on top of Java would have achieved the same thing.

  20. Please don't start you sentences in the subject... by Tubal-Cain · · Score: 2, Informative

    ...line. It is disorienting for the people that don't always read the subject line (almost everybody). And capitalizing the first word of the body text when the word takes place in the middle of the sentence doesn't help, either.

  21. Re:The questions remains... by Otterley · · Score: 4, Insightful

    These days I'm writing exclusively in Ruby and it is "fast enough" (even with 1.8.X).

    I suspect that's because your website doesn't receive thousands of dynamic requests per second.

  22. Re:GCC avoids high level interprocedural optimizat by jcr · · Score: 3, Insightful

    So, GCC is making what should be technical decisions on a political basis?

    Good to know. That's one more reason to be glad when GCC fades away.

    -jcr

    --
    The only title of honor that a tyrant can grant is "Enemy of the State."
  23. just you wait... by 3seas · · Score: 3, Insightful

    ... for them to get further along in completing it... it'll slow down.

  24. Re:All right! by Antique+Geekmeister · · Score: 2, Informative

    Care to bet on that? I've seen 5 minute boot times for XP on end-of-life hardware, primarily due to massive delays in indexing large disk drives. And no, it's not "booted" until it gives you a usable mouse and keyboard. Printing up the Windows boot screen and ignoring you for another few minutes does not count as "booted". Vista is noticeably worse on the same hardware due to the larger memory footprint: Win9x used to be OK on the hardware.

  25. Re:Apple's work on LLVM by jcr · · Score: 2, Interesting

    You may not want to believe it, but when GCC came out there was a pretty healthy competition going with plenty of vendors offering C compilers, and driving each other to improve their products. RMS decided to put them out of business, and the upshot was that commercial compiler development came to a screeching halt, with a few exceptions like IBM and Motorola working on their optimizers. There were a few scattered academic projects going on, but GCC wiped out everyone in the compiler business besides microsoft and metrowerks.

    Fortunately, one of those academic projects came to Apple's attention, and it's about to bring the dark ages to an end.

    -jcr

    --
    The only title of honor that a tyrant can grant is "Enemy of the State."
  26. Re:Apple's work on LLVM by rmav · · Score: 3, Insightful

    The main effect of GCC for the last 20 years has been to suck all of the air out of the room for anyone else who wanted to develop compilers.

    That is one of the most retarded statements I've ever read.

    No. What the poster said is true. Also unfair, because GCC is a very useful tool, but it still had a bad influence as well. GCC is extremely useful and produces decent code as well, but it has effectively stifled a lot of C/C++ compiler research. And it seems to become slower with each release. I have a lot of code that was faster with 2.95 than with any 3.x release, and with 4.x it is even slower.

    Now, LLVM is still a mixed bag, sometimes code is much faster, sometimes a bit slower, and does not compile everything I throw at it, but it is impressive technology. It has a more modern infrastructure, and finally allows things like compiling to bytecode and dynamic run-time optimisation with C. It may even allow for CPU-independent operating systems in the future, where you have LLVM bytecode in the binaries that will run like natively-compiled code once loaded.

    I compiled some C programs _to_ LLVM bytecode and then ran them on my mac.

    Their performance was comparable, oftentimes better, than that of the same programs compiled with a recent GCC. And I can still add inline assembler, which then is used only on the right architecture, if I provide C alternatives.

    Think about this. This has the potential of *finally* freeing us from dependence on a CPU ISA. It may be an Apple-sponsored project, but we all should be grateful to them that they are actually pushing it.

    Roberto

  27. Re:The questions remains... by FooBarWidget · · Score: 2, Informative

    Tell that to MTV and New York Times. Yes, they run Rails. Not on the front page, but nevertheless, they use it on very busy parts of their sites.

    And heck, do I even need to mention 37signals? Those guys receive tons and tons of requests per second.

  28. Re:Ruby? by Serious+Callers+Only · · Score: 2, Insightful

    Because puts { "I like beans" } is 9000% better than just typing I like beans.

    What a terrible example

    1. It's not functioning Ruby (try puts "I like beans", like most languages in fact)

    2. It has nothing to do with the strengths or failings of Ruby as a language.

    Do you know anything about Ruby? Do your empty platitudes about 'layers upon layers of complexity' actually have any basis in reality? From your comment, I suspect not.

    There are some not so nice corners of Ruby, but an attempt to oversimplify is not one of them.

  29. Re:The questions remains... by FooBarWidget · · Score: 3, Informative

    "Thanks, Captain Anecdote, but you've left out even the anecdotal evidence. What's all this exclusive writing you're doing with Ruby? I've been doing all my grocery list work in Ruby too, and it's *totally* fast enough."

    I'm not the GP, but New York Times, MTV, Aboutus.com (high-ranking Alexa site), Yellow Pages, are all running Ruby. I'd love to give you even more examples but I've signed NDAs.

    "I think Ruby is a fantastic language, but then I see comments like this modded up to 5 that are completely nonsensical. This makes Ruby fandom seem more like Java 1999, which makes me think twice about my positive opinion of it."

    I can say the same thing about comments that complain about Ruby's speed without providing any kind evidence that the interpreter's speed is the bottleneck in their application. This makes it seem like bashing Ruby is just the latest fad, which makes it very hard for me to take any of these complaints seriously. If you cry wolf several times then nobody will listen to you anymore.

  30. Re:Apple fan flaming OSS??? by DECS · · Score: 2, Insightful

    While that's certainly true, OSS also benefits a lot from Apple. Without Mac OS X, BSD would have 25 million fewer users exercising its code.

    Apple also owns CUPS and finances LLVM and WebKit and initiated Darwin Calendar Server and lots of other projects. Had the world not rejected NeXT and Unix to race after Microsoft's vaporware in the 90s, all the effort at reinventing BSD as Linux could have been united into a single OSS effort. So Apple has been working against the tide to return the world back to open, interoperable software.

    I think open interoperability is more important that forcing companies to propagate an ideology that only hardware should be marketable.