How fast does your Ruby run?

  • Thread starter SpringFlowers AutumnMoon
  • Start date
C

Chuck Remes

Program changed a little:

Someone is going to point this out sooner or later so it may as well be me.

Your "benchmark" doesn't test Ruby performance. It tests the performance of the Enumerable#inject method. Each runtime will have different results for running that one method but you can't really draw any conclusions about overall runtime performance. It's a micro-benchmark without a lot of usefulness.

cr
 
R

Robert Dober

How fast does my Ruby run?! You've never heard of The Millenium Ruby?
It's the version that made the GNU/Kessel run in less than 12
parsecs!

It's run faster than Imperial programming languages. Not the local
bulk Java installs, mind you. I'm talking the big MS C# installs.

Actually it runs slower than those, but it seems faster because the
others normally depart when the Millenium Ruby has already arrived.
Well depends on the pilot too.
R.
 
J

Jian Lin

Chuck said:
Someone is going to point this out sooner or later so it may as well be
me.

Your "benchmark" doesn't test Ruby performance. It tests the performance
of the Enumerable#inject method. Each runtime will have different
results for running that one method but you can't really draw any
conclusions about overall runtime performance. It's a micro-benchmark
without a lot of usefulness.

It is just to get an idea, really.
How comprehensive do you expect the benchmark to be when the test is
only 2 nested loops in 3 lines?
 
J

Jeff Moore

Jian said:
How fast does your Ruby run?

I got 53648 iterations per second running the following program,
on an Intel 3.2 GHz HT, Win XP machine:

--------

C:\> ruby calculate.rb
55

Ruby 1.8.6 patch 0 on i386-mswin32
It took 18.64 seconds to run. 53648 iterations per second.

Running the original code:

Ruby 1.9.1 patch 378 on x86_64-linux
It took 1.277456379 seconds to run. 782805 iterations per second.

Compiled on a Phenom II X4 955 with gcc 4.4.1 with -O3 -mtune=native
OS: Ubuntu 9.10
 
Joined
Jul 30, 2022
Messages
2
Reaction score
0
Running the original code:

Ruby 1.9.1 patch 378 on x86_64-linux
It took 1.277456379 seconds to run. 782805 iterations per second.

Compiled on a Phenom II X4 955 with gcc 4.4.1 with -O3 -mtune=native
OS: Ubuntu 9.10

This is on my MacBook Air M2 as on 2022-07-30:

Ruby 2.6.8 patch 205 on universal.arm64e-darwin21
It took 0.321619 seconds to run. 3109269 iterations per
second.
 
Joined
Jul 30, 2022
Messages
2
Reaction score
0
This is on my MacBook Air M2 as on 2022-07-30:

Ruby 2.6.8 patch 205 on universal.arm64e-darwin21
It took 0.321619 seconds to run. 3109269 iterations per
second.

That's a bit interesting... my MacBook Pro M1 Pro 16 inch is slower than the M2:
(both machines freshly rebooted running almost nothing)

Ruby 2.6.8 patch 205 on universal.arm64e-darwin21
It took 0.346958 seconds to run. 2882193 iterations per
second.
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top