concept performance in category groovy

This is an excerpt from Manning's book Groovy in Action, Second Edition.
This chapter follows the model of an overture in classical music, in which the initial movement introduces the audience to a musical topic. Classical composers weave euphonious patterns that are revisited, extended, varied, and combined later in the performance. In a way, overtures are the whole symphony en miniature.
The pattern operator allows you to split pattern-creation time from pattern-matching time, increasing performance by reusing the finite-state machine. The following listing shows a poor-man’s performance comparison of the two approaches. The precompiled pattern version is at least twice as fast (although these kinds of measurements can differ wildly).
Don’t forget that performance should usually come second to readability—at least to start with. If reusing a pattern means bending your code out of shape, you should ask yourself how critical the performance of that particular area is before making the change. Measure the performance in different situations with each version of the code, and balance ease of maintenance with speed and memory requirements.