3 ms·
Your explanation of structural sharing makes sense but there's a lot of nuance there: 1. Elixir strings are Erlang binaries (byte arrays), not charlists. Charl
by ramchip 4y ago
Your explanation of structural sharing makes sense but there's a lot of nuance there:
1. Elixir strings are Erlang binaries (byte arrays), not charlists. Charlists are becoming rare nowadays even in Erlang because they're so memory-inefficient.
2. Comparing two lists for equality requires traversing them, you can't just look at the first node. If they were built independently they won't share structure.
3. HTML templating is (reasonably) efficient because of iodata, not charlists.