3 ms·
Probably not entirely, Erlang's lightweight processes have their own private heap (~1.8KB by default on a 64b system), a process dictionary and likely more cont
by masklinn 11y ago
Probably not entirely, Erlang's lightweight processes have their own private heap (~1.8KB by default on a 64b system), a process dictionary and likely more control structures, and the language is mainly interpreted. A 4x different in performance may be on the high side (idk), but I wouldn't expect erlang processes to be quite as fast to spawn as goroutines.
edit: and the erlang bench allocates a bunch of lists on startup: https://github.com/atemerev/skynet/blob/master/erlang/skynet.erl#L10 https://github.com/atemerev/skynet/blob/master/erlang/skynet... `lists:seq()` will allocate a 10-elements linked list, considering this is called recursively and concurrently it might contribute to the issue (or not)
- deleted 11y ago[deleted]
- dxhdr 11y agoMinor clarification -- Erlang is not interpreted, it's compiled to bytecode and executed on the BEAM virtual machine.
- masklinn 11y ago> Erlang is not interpreted, it's compiled to bytecode and executed on the BEAM virtual machine. And Python is compiled to bytecode and executed on the CPython virtual machine. That's still interpreted.
- jlouis 11y agoThe major problem, without any measurement and just guesswork, is that you have a larger allocation overhead in Erlang. Not only do you need the process control block for the process, you also need to go to the memory subsystem and grab a heap for the process. In the Go variant, you are allocating out of the same heap and you can usually avoid some allocation there because everything you allocate is used. Not so in the Erlang system. Were these processes/goroutines to do anything more complex, then the difference goes toward zero. But the constant overhead at the lowest level is probably higher.