Simon Peyton Jones's "The implementation of functional programming languages" has a chapter on the "Efficient compilation of pattern matching" (chapter 5 by Philip Wadler).
https://simon.peytonjones.org/assets/pdfs/slpj-book-1987-2up...
https://simon.peytonjones.org/assets/pdfs/slpj-book-1987-2up...
It explains how to minimize the decisions trees you obtain from a match statement, so you gain a ton of efficiency over a naive implementation, especially for large, multi-column matches.