Improve performance of patterns