Improve timing of PatMatchTool by buffering the state in the inner loop. Gains about 45% according to callgrind.