$ the-wire · showcase
Consolidated protocols drop apply for literal external funs
By RepoJournal · Filed · About Elixir & Phoenix · Composed from the cited sources · methodology
Elixir reworked protocol consolidation so that calling a consolidated protocol no longer routes through apply, removing an export-table lookup from every protocol call site.
Dispatch consolidated protocols through literal external funs elixir-lang/elixir
Consolidated protocol functions used to call impl_for!/1 and then reach the implementation through a dynamic Module.fun(...) call, which compiles to apply and looks up the export table on every invocation. Protocol functions are now identical before and after consolidation: they call the function returned by an inlined __dispatch_impl__/4, which captures it from the implementation module before...