What efficient pattern matching looks like at the bytecode level
https://dockyard.com/blog/2018/02/27/what-efficient-pattern-matching-looks-like-at-the-bytecode-level [dockyard.com]
2018-04-22 16:15
My theory is that this is how BEAM makes pattern matching efficient in general: it finds prefixes that can be matched against with select_val. As a corollary if you don’t see a select_val in your bytecode, then you’re not getting the most-efficient pattern matching branching as the pattern checks have to be implemented as separate bytecode instructions, and it might make sense to rearrange clauses that don’t affect semantics to see if a select_val pops out in generated bytecode.
source: L