3 ms·
The BEAM virtual machine is able to reorder most clauses based on need, and for most cases, a binary search will be done through all clauses. Exceptions include
by mononcqc 13y ago
The BEAM virtual machine is able to reorder most clauses based on need, and for most cases, a binary search will be done through all clauses. Exceptions include function clauses with guards, which cannot easily be reordered but still impact whether a clause will be used or not.
The VM will instead try to reorder the clauses up until the next guard clause, if possible.
You should mostly care about writing readable code and let the compiler and the VM do the rest.