5 ms·
Crazy thing is, Ruby is already so much more powerful than Javascript. Javascript is fast, easy to implement and relatively easy to learn - but it is so limited
by DevFactor 12y ago
Crazy thing is, Ruby is already so much more powerful than Javascript. Javascript is fast, easy to implement and relatively easy to learn - but it is so limited.
As a programming language, Ruby really pushes the limits of what we are used to.
- pjmlp 12y agoDylan and Lisp/Scheme are way more powerful than Ruby and compile to native code. Ruby pushes what?! I bet you never used a commercial Smalltalk system.
- eropple 12y agoThere are always touchy Lisp and Smalltalk fans who must vent their spleens at the earliest opportunity, but barely a sliver of active developers today have used a Smalltalk system and only marginally more, even with Clojure, have used a Lisp in anger. So, when you are not actively trying to read the literal worst into something, you will see that Ruby does in fact do quite a lot that "we," in the general case, are not terribly used to. That's a major reason I use it, for example, where performance isn't a big deal.
- matthewmacleod 12y agoIt's not a surprise with attitudes like that! Ruby is popular because it's powerful and expressive in a way that many other environments are not. 'Power' isn't everything - ability to easily use it is equally important. Hell, it's a direct spiritual descendent of Smalltalk to a greater degree than any other popular language! The performance of Ruby caused by the extensiveness of its dynamism had definitely been one of the downsides of the language, and the fact that newer languages place more emphasis on that while learning from Ruby is great - it's how the field evolves!
- vezzy-fnord 12y agoGiven you mentioned Smalltalk, you might be interested in this LtU post: http://lambda-the-ultimate.org/node/2606 http://lambda-the-ultimate.org/node/2606
- adamnemecek 12y agoIronically, that power has its costs. The ability to be made fast is one of those costs.
- seanp2k2 12y agoThe thing is though, if you have a super performance-critical bit that you can't make fast in Ruby, you can still drop down to C if you really have much to gain. For a lot of what it gets used for, though (system scripting, web apps, automation), it's fast enough that the language niceties trump raw speed.
- adamnemecek 12y agoThat's nice but somewhat irrelevant. The discussion is about how to make Python or Ruby fast, your solution is basically "just rewrite it in C, lol". It's a workaround but ideally you should not have to do that.
- m_mueller 12y agoAh the hot spot fallacy. I don't mean that Ruby / Python don't have their place, I'm using a lot of Python myself. However, the notion that you could always just reimplement a few places here and there in C is mostly false IMO. In these cases where the interpreter itself is the bottleneck (as opposed to I/O), you'll often find that the performance is spread out over dozens or hundreds of sections in your code - for non trivial projects. When that happens and you really need an order of magnitude or more speedup, you basically have to reimplement. What I want to say is: In many cases starting with a scripting language makes sense, just to get a working prototype quickly, but when you know beforehand that performance is critical, don't overestimate the ability to just patch it up later. The whole 'premature optimization' viewpoint should (if at all) only be applied up to a certain experience level, after which it's rather damaging than doing any good.
- pekk 12y agoIt would only be a "fallacy" if it were literally not possible to optimize using C extensions. It has been done, many times, for many real jobs. There is no fallacy.
- fpgaminer 12y agoIt has always been this way. Two decades ago ASM was fast but limited; BASIC was expressive but slow. Today, JavaScript is fast but limited; Ruby is expressive but slow. What a wonderful transition; it means our fast language du jour is growing more and more expressive. Another two decades of compiler and optimization research and we may yet have fast languages that are so expressive they negate the need for anything more powerful.