One thing to consider is that even though Map.fetch!/2
and map_get/2
would have the same functionality, they are slightly different from the VM perspective. Most notably, Map.fetch!/2
is a regular function, so it can be traced, while map_get/2
is a guard BIF, so it cannot be traced. Additionally, since Map.fetch!/2
is a regular function, it requires setting up a stack in the caller and is potentially slightly more expensive.
9 Likes