in reply to Re: perl5 road map?
in thread perl5 road map?
How much time it will take if you add -MMoose I wonder? The thing is that in Erlang time and memory required to create a new process (it doesn't have threads) don't depend on what modules are loaded. At any time you can spawn several dozens of thousands of processes and it won't generally consume all available memory. Perl creates full copy of the interpreter for every thread, so you can't have too many of them, especially if you want to use something heavy in threads, like Moose. Don't pretend you don't know that.
Comparison doesn't really make sense and one-liners are not a strong side of Erlang, but here's an example from Erlang Programming that creates 10000 processes (in the book they actually starting at 100000):
-module(myring). -export([start/1, start_proc/2]). start(Num) -> start_proc(Num, self()). start_proc(0, Pid) -> Pid ! ok; start_proc(Num, Pid) -> NPid = spawn(?MODULE, start_proc, [Num-1, Pid]), NPid ! ok, receive ok -> ok end.
And running it from the erl:
3> timer:tc(myring,start,[10000]). {14283,ok}
Time is in microseconds.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: perl5 road map?
by BrowserUk (Patriarch) on Mar 24, 2012 at 15:27 UTC | |
by zwon (Abbot) on Mar 24, 2012 at 17:20 UTC | |
by BrowserUk (Patriarch) on Mar 24, 2012 at 23:01 UTC | |
by xiaoyafeng (Deacon) on Mar 25, 2012 at 08:31 UTC | |
by Happy-the-monk (Canon) on Mar 25, 2012 at 09:15 UTC |