Is &foo/1 really faster than &foo(&1)

There’s however a difference between &Module.fun/2 vs. any other form. The fully quantified version (mod, fun and arity) can be optimized to not use an anonymous function, which makes it more performant. This is important in situations like :telementry handlers, which might be called very often, as described in the docs:

https://hexdocs.pm/telemetry/1.1.0/telemetry.html#attach/4

3 Likes