ponylang/ponyc

Slow compare to elixir in `ring benchmark`

madper opened this issue · 2 comments

madper commented

Taken from "Programming Erlang", second edition (by Joe Armstrong):

Write a ring benchmark. Create N processes in a ring. Send a message
round the ring M times so that a total of N * M messages get sent. Time
how long this takes for different values of N and M.
Write a similar program in some other programming language you are
familiar with. Compare the results. Write a blog, and publish the results
on the Internet!

Pony impl is far slow than elixir one.
图片

https://github.com/meox/O-Ring <-- source code

The is not an actionable issue. If you would like to discuss how to improve the performance of your version, you can join the performance help stream on the ponylang Zulip.

Leaving this ticket closed because, as Sean said - this is for issues with the compiler as opposed to language help. (Come say Hi on Zulip).

But after an hour or so (… and I am FAR from a performance expert), I got:

[red@blimpofevil:~/projects/O-Ring/erlring]$ ./ring 200000 30
1935 6096 200000 30
[red@blimpofevil:~/projects/O-Ring/exring]$ ./exring 200000 30
838 6461 200000 30
[red@blimpofevil:~/projects/O-Ring/ponyring2]$ ./ponyring2 200000 30
507 3603 200000 30

As a comparison, the original version in the repo gets:

[red@blimpofevil:~/projects/O-Ring/ponyring]$ ./ponyring 200000 30
3575 15777 200000 30

I'm sure there is still much room for improvement which we can discuss on Zulip.

I'll be raising a PR on said repository with my alternative version.

Red