Live data from Hacker News

Ruby is faster than Python, PHP, and Perl

unlimitednovelty.com

1–10 of 16 posts

Re: Ruby is faster than Python, PHP, and Perl

#2
Does this really matter?

I mean,seriously, if speed is what you want, you'd write it in C. These days, with virtually unlimited CPU, we choose our languages based on suitability for the task, readability and community support (at least I do).

Other than assembler for games, I have never chosen a language based on speed of execution. Anyone else?

Can't we also just compile Ruby (or PHP or Python) to C and then let the C compiler optimize it these days? I think we can.

Additionally, the fact that Javascript kicks the crap out of the vast majority of languages is surprising to me.

Re: Ruby is faster than Python, PHP, and Perl

#5

Does this really matter? I mean,seriously, if speed is what you want, you'd write it in C. These days, with virtually unlimited CPU, we choose our languages based on suitability for the task, readability and community support (at least I do). Other than assembler for games, I have never chosen a language based on speed of execution. Anyone else? Can't we also just compile Ruby (or PHP or Python) to C and then let the…

Does it matter, nope.

I think this is just leftover annoyances from pre 1.9 mri perfomance is all.

As to compiling ruby to c, maybe, as long as its not eval()'ing ruby code. But rubinius+llvm+its jit would be the closest to what you're talking about. That or jruby too.

Re: Ruby is faster than Python, PHP, and Perl

#7

Does this really matter? I mean,seriously, if speed is what you want, you'd write it in C. These days, with virtually unlimited CPU, we choose our languages based on suitability for the task, readability and community support (at least I do). Other than assembler for games, I have never chosen a language based on speed of execution. Anyone else? Can't we also just compile Ruby (or PHP or Python) to C and then let the…

Other than assembler for games, I have never chosen a language based on speed of execution. Anyone else?

I once moved a major processing step from the database to C++. Execution time went from an estimated 1 week to a measured 5 minutes.

Why was the difference that big?

The fastest path to get a piece of data in the database is to do a binary search on an index that tells you what row in the table has your data, and what page of memory it is in. You then go to that page in memory, locate the row, parse it, and pull out the information of interest. All of this is controlled by instructions in some sort of microcode.

The equivalent data path is C++ was, "follow a pointer". Furthermore the C++ representation of the data was so much more compact that I was frequently managing to stay inside of CPU caches, versus the database approach where I was fighting to stay within RAM limitations.

Sometimes performance really, really does matter. (This is a rare circumstance.)

As for JavaScript, the reason that it beats everything else is that there is serious corporate muscle (eg Google and Apple) behind optimizing it as much as possible.

Re: Ruby is faster than Python, PHP, and Perl

#9

Does this really matter? I mean,seriously, if speed is what you want, you'd write it in C. These days, with virtually unlimited CPU, we choose our languages based on suitability for the task, readability and community support (at least I do). Other than assembler for games, I have never chosen a language based on speed of execution. Anyone else? Can't we also just compile Ruby (or PHP or Python) to C and then let the…

I imagine Javascript's advantage is because V8 is a JIT compiler. It's unfortunate LuaJIT is not shown since it would probably be around the same level or higher than V8.

Re: Ruby is faster than Python, PHP, and Perl

#10

Does this really matter? I mean,seriously, if speed is what you want, you'd write it in C. These days, with virtually unlimited CPU, we choose our languages based on suitability for the task, readability and community support (at least I do). Other than assembler for games, I have never chosen a language based on speed of execution. Anyone else? Can't we also just compile Ruby (or PHP or Python) to C and then let the…

Most JavaScript implementations are faster just due to the amount of R&D dollars poured into them due to browser competition. Ruby, Python, and PHP could (and should) have runtimes competitive with, say, V8, it's just that nobody has built them yet.
Post reply on HN