4 ms·
That's incorrect, there is no serialization when sending messages to processes that are on the same machine. (Otherwise it's transparent to the application, tho
by jake_morrison 5y ago
That's incorrect, there is no serialization when sending messages to processes that are on the same machine. (Otherwise it's transparent to the application, though of course there are performance impacts.)
To the programmer, messages are immutable. There are, however, optimizations to reduce the performance impact, particularly for binary data. When you send a binary message that is longer than 64 bytes, it is actually stored in a shared heap and effectively only a reference is passed as a message. Similarly, when you extract a small piece out of a larger binary, you might actually get a reference to the larger data stored on the binary heap. The Erlang VM has had more than 30 years of development, and there are a lot of subtle optimizations like this which were needed to solve real world performance and scaling issues.
Lack of serialization is one thing that makes e.g. the ETS key/value store built into the VM nice compared to Redis. You can just use raw data structures as keys and values. Reads and writes are under 1 microsecond.