Andre Vieira(2): Backporting algorithmic optimization in match and simplify Backporting fix for PR-67948.
This series is aimed at backporting algorithmic optimizations and a
change to a test it affects from trunk to the embedded-5-branch.