Performance vs Ruby performance

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Performance vs Ruby performance

Vitor Medina Cruz
Hello,

How is Pharo compared with Ruby in terms of performance? Has someone done some comparison benchmark? If yes, that was done with other platforms?

Regards,
VItor
Reply | Threaded
Open this post in threaded view
|

Re: Performance vs Ruby performance

Clément Béra
What ruby runtime exactly ? The standard ruby interpreter, rubinius, JRuby ?

What do you mean by performance ? Smallest time to run long computation ? Latency for web servers ? Pauses in real time applications ?

The standard ruby interpreter is really slow (likely ~100 times slower than the Pharo 5 VM), now it binds directly multiple C librairies, such as the regex librairy, while these librairies are written in Smalltalk in Pharo. So if you measure regex performance I am pretty sure that ruby is at least 10 times faster, if not 100 times.

So basically it depends on what benchmark you are measuring. We don't do cross languages benchmarks in our servers, only versus other Smalltalks. That website (http://benchmarksgame.alioth.debian.org/) compares ruby and JRuby to VW which has similar speed to Pharo 5.



On Thu, Sep 8, 2016 at 1:28 AM, Vitor Medina Cruz <[hidden email]> wrote:
Hello,

How is Pharo compared with Ruby in terms of performance? Has someone done some comparison benchmark? If yes, that was done with other platforms?

Regards,
VItor

Reply | Threaded
Open this post in threaded view
|

Re: Performance vs Ruby performance

kilon.alios
In reply to this post by Vitor Medina Cruz
It does not matter. When it comes to performance the workflow is always the same whatever the language you use.

1. Profile the code see where it consume most CPU cycles
2. Can you improve the code to remove unnecessary processing ? You will be surprised how many times its your code and not the language that is slow
3. If it's not your code can you find a library written in C that is optimized for speed ?
4. If no then write the code in C compile it as shared library and use it from the language of your choice using an FFI

Basically when a VM in a dynamic language finds a call to a C shared library using the FFI it will freeze everything and give priority to the C code to execute the call to its native speed. Then after the execution the VM resumes. There is an overhead however for making the call.

Because speed depends on the factors I described above for many experienced coders general benchmarks are completely useless.

Speed in the end is just machine code with as less instructions as possible using most hardware acceleration as possible.

Talking about hardware acceleration if you try to do the same processing on a list of data which is very large in parallel don't even consider C , instead go directly to GPU because it can accelerate even up to 100 times compared to CPU. But in the end will depend on how much speed you really need. If you indeed need it then you can accelerate your code using the GPU with the help of CUDA or OpenCL.

Remember however that optimizing is the root of true evil , it will make your code ugly, hard to read, difficult to extend and much more buggy.

PS: the vast majority of benchmarks including the ones linked by Clement use just code written in the language tested also using the library that the language comes with. That means that they use none of the normal optimizations I described above and hence they cannot be considered practical realistic scenarios.

On Thu, 8 Sep 2016 at 02:30, Vitor Medina Cruz <[hidden email]> wrote:
Hello,

How is Pharo compared with Ruby in terms of performance? Has someone done some comparison benchmark? If yes, that was done with other platforms?

Regards,
VItor
Reply | Threaded
Open this post in threaded view
|

Re: Performance vs Ruby performance

Vitor Medina Cruz
Thank you for the answers!

On Thu, Sep 8, 2016 at 3:31 AM, Dimitris Chloupis <[hidden email]> wrote:
It does not matter. When it comes to performance the workflow is always the same whatever the language you use.

1. Profile the code see where it consume most CPU cycles
2. Can you improve the code to remove unnecessary processing ? You will be surprised how many times its your code and not the language that is slow
3. If it's not your code can you find a library written in C that is optimized for speed ?
4. If no then write the code in C compile it as shared library and use it from the language of your choice using an FFI

Basically when a VM in a dynamic language finds a call to a C shared library using the FFI it will freeze everything and give priority to the C code to execute the call to its native speed. Then after the execution the VM resumes. There is an overhead however for making the call.

Because speed depends on the factors I described above for many experienced coders general benchmarks are completely useless.

Speed in the end is just machine code with as less instructions as possible using most hardware acceleration as possible.

Talking about hardware acceleration if you try to do the same processing on a list of data which is very large in parallel don't even consider C , instead go directly to GPU because it can accelerate even up to 100 times compared to CPU. But in the end will depend on how much speed you really need. If you indeed need it then you can accelerate your code using the GPU with the help of CUDA or OpenCL.

Remember however that optimizing is the root of true evil , it will make your code ugly, hard to read, difficult to extend and much more buggy.

PS: the vast majority of benchmarks including the ones linked by Clement use just code written in the language tested also using the library that the language comes with. That means that they use none of the normal optimizations I described above and hence they cannot be considered practical realistic scenarios.

On Thu, 8 Sep 2016 at 02:30, Vitor Medina Cruz <[hidden email]> wrote:
Hello,

How is Pharo compared with Ruby in terms of performance? Has someone done some comparison benchmark? If yes, that was done with other platforms?

Regards,
VItor