'. '

RubySpeed

From APIDesign

(Difference between revisions)
Jump to: navigation, search
Line 7: Line 7:
Is [[Truffle]] based [[Ruby]] ten times faster? [https://youtu.be/ufShKmS5Ueo The video] shows that standard [[Ruby]] can compute about 5000 of prime numbers in 20s on my computer. The [[Truffle]] version was able to compute 17000 of primes. For a while I believed that this implies three times speed up. Not bad, but far less than the claim of being ten times faster.
Is [[Truffle]] based [[Ruby]] ten times faster? [https://youtu.be/ufShKmS5Ueo The video] shows that standard [[Ruby]] can compute about 5000 of prime numbers in 20s on my computer. The [[Truffle]] version was able to compute 17000 of primes. For a while I believed that this implies three times speed up. Not bad, but far less than the claim of being ten times faster.
-
However once, while showing the demo, [[I]] forgot to kill the standard [[Ruby]] version. After three minutes [[I]] noticed that and to my surprise the standard version was still fighting with 15000th prime number - e.g. it takes at least 180s to compute what [[Truffle]] [[Ruby]] can in 20s. And that actually means ten times speed up!
+
However once, while showing the demo, [[I]] forgot to kill the standard [[Ruby]] version. After three minutes [[I]] noticed that and to my surprise the standard version was still fighting with 15000th prime number - e.g. it takes at least 180s to compute what [[Truffle]] [[Ruby]] can in 20s. The explanation is easy - computing first thousands of primes is way easier that finding the next thousands ones. The [[wikipedia:Sieve_of_Eratosthenes|sieve of Eratosthenes]] algorithm isn't linear. Only comparing the time to compute the same amount of primes that makes a sense. However the time actually shows ten times speed up!
[[Truffle]] gives [[Ruby]] the speed it always needed.
[[Truffle]] gives [[Ruby]] the speed it always needed.
[[Category:Video]]
[[Category:Video]]

Revision as of 12:21, 2 October 2015

Ruby was always known to be very slow language. Even when the hype around Rails was on - e.g. around 2006, there was nobody who could make the language fast. The great news is that OracleLabs decided to demonstrate the power of their Truffle framework on Ruby and are working on a fast Ruby implementation. OracleLabs claim that their implementation is ten times faster than the standard Ruby.

I wanted to verify such claim. One thing is being faster in a benchmark, the other thing is to speed up real programs. That is why I decided to write my first Ruby program - the sieve of Eratosthenes and as following video demonstrates, Truffle based Ruby is really faster:

Is Truffle based Ruby ten times faster? The video shows that standard Ruby can compute about 5000 of prime numbers in 20s on my computer. The Truffle version was able to compute 17000 of primes. For a while I believed that this implies three times speed up. Not bad, but far less than the claim of being ten times faster.

However once, while showing the demo, I forgot to kill the standard Ruby version. After three minutes I noticed that and to my surprise the standard version was still fighting with 15000th prime number - e.g. it takes at least 180s to compute what Truffle Ruby can in 20s. The explanation is easy - computing first thousands of primes is way easier that finding the next thousands ones. The sieve of Eratosthenes algorithm isn't linear. Only comparing the time to compute the same amount of primes that makes a sense. However the time actually shows ten times speed up!

Truffle gives Ruby the speed it always needed.

Personal tools
buy