Improve pattern matching performance.
Merge pull request #207 from kennytm/faster-pattern-match

Improve pattern matching performance for common cases