Mix v1.4.5 mix compile.protocols View Source
Consolidates all protocols in all paths.
This task is automatically invoked unless the project
disables the :consolidate_protocols option in their
configuration.
Consolidation
Protocol consolidation is useful in production when no dynamic code loading will happen, effectively optimizing protocol dispatches by not accounting for code loading.
This task consolidates all protocols in the code path and outputs the new binary files to the given directory (defaults to “_build/MIX_ENV/consolidated”).
In case you are manually compiling protocols or building releases, you need to take the generated protocols into account. This can be done with:
$ elixir -pa _build/MIX_ENV/consolidated -S mix run
You can verify a protocol is consolidated by checking its attributes:
$ iex -pa _build/MIX_ENV/consolidated -S mix run
iex> Protocol.consolidated?(Enumerable)
true
Link to this section Summary
Link to this section Functions
Cleans up consolidated protocols.
A task needs to implement run which receives
a list of command line args.
Callback implementation for Mix.Task.run/1.