3 ms·
Slightly heavier than goroutines: according to the efficiency guide[0] a process is 338 words (2704 bytes), when spawned. This includes a 233 words (1864 bytes
by masklinn 6y ago
Slightly heavier than goroutines: according to the efficiency guide[0] a process is 338 words (2704 bytes), when spawned.
This includes a 233 words (1864 bytes) private heap.
This likely wouldn't work for TFA (as it uses "active" threads) but it should go lower if you immediately hibernate the processes:
> The heap is then shrunken to the exact same size as the live data that it holds (even if that size is less than the minimum heap size for the process).
While I've not tested it, I assume a just-started process has nothing on the heap, so it'd go down to just the "overhead" 105 words (840 bytes).
Though that's at the cost of immediately allocating a new min-sized heap when the process wakes up.
[0] http://erlang.org/doc/efficiency_guide/advanced.html http://erlang.org/doc/efficiency_guide/advanced.html