3 ms·
Surely a Sufficiently Smart Compiler could optimize all of these to only take the a constant amount of memory (and less time). I wonder if there are any correc
by thethirdone 3y ago
Surely a Sufficiently Smart Compiler could optimize all of these to only take the a constant amount of memory (and less time).
I wonder if there are any correctness constraints that would actually prevent such optimizations. For example, the compiler might be required to execute the exact same system calls as an unoptimized program. It seems quite reasonable that the programs using system threads could not be optimized significantly under such a constraint.
I would expect the larger limit that prevents compilers from optimizing this is the large amount of code that defines the semantics of the lightweight threads. For example, I would expect the observable / required behaviors of tokio to not prevent a SCC from optimizing it, but the massive amount of Rust code that defines the lightweight thread semantics cannot be reasonably optimized.
Which programming language / framework is the closest to actually being optimized to like < 4 byte / task? I would make an uneducated guess of Elixir or Go.
- sb8244 3y agoEach BEAM process comes with its own stack / heap space. This uses a minimum of 326 words of memory (https://www.erlang.org/doc/efficiency_guide/processes.html#creating-an-erlang-process https://www.erlang.org/doc/efficiency_guide/processes.html#c...)