21.20 Performance of match
Expressions
Despite their flexibility, Rust’s match
expressions often compile down to highly efficient code. Depending on the situation, the compiler might use jump tables, optimized branch trees, or other techniques. In practice, match
is rarely a performance bottleneck, though you should always profile if you’re in performance-critical territory.