15 Jul 2013, 03:42
Dave_gnome_head_isolated_pragsmall

Dave Thomas (340 posts)

  • Run this code on your machine. See if you get comparable results.
08 Sep 2013, 14:23
200-g_pragsmall

Aleksey Gureiev (11 posts)

I ran your code on my MacbookPro 2.66 i7 (2 cores) 8Gb RAM and it’s pretty linear, and even slower (starting from 1000 processes) than what you had.

iex(27)> Threads.run(10)
Result: 10
{96, :ok}
:ok

iex(28)> Threads.run(100)
Result: 100
{1060, :ok}
:ok

iex(29)> Threads.run(1000)
Result: 1000
{11072, :ok}
:ok

iex(30)> Threads.run(10000)
Result: 10000
{92934, :ok}
:ok

iex(31)> Threads.run(100000)
Result: 100000
{814138, :ok}
:ok

Any idea what’s going on?

06 Jan 2015, 13:52
Generic-user-small

Pierre Sugar (55 posts)

It is just fun watching all cores getting to work. Even though your Mac machines are notably faster than my hp Pavillion with AMD A10-5745M APU having 4 cores and 8 GB RAM.

$ elixir -r chain.exs -e "Chain.run(10)"
{11370, "Result is 10"}
$ elixir -r chain.exs -e "Chain.run(100)"
{20132, "Result is 100"}
$ elixir -r chain.exs -e "Chain.run(1000)"
{23993, "Result is 1000"}
$ elixir -r chain.exs -e "Chain.run(10000)"
{129988, "Result is 10000"}
$ elixir -r chain.exs -e "Chain.run(100000)"
{1145274, "Result is 100000"}
$ elixir --erl "+P 1000000" -r chain.exs -e "Chain.run(1000000)"
{11645488, "Result is 1000000"} 
  You must be logged in to comment