Ticket #342 (closed enhancement: fixed)
custom-made re-engine in SelectorUtils is awful slow
| Reported by: | uwe@… | Owned by: | mrook |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.4.0RC1 |
| Component: | phing-core | Version: | 2.3.2 |
| Keywords: | Cc: |
Description
The methods match() and matchPath() in SelectorUtils are quite slow doing a regular expression matching "by hand". Instead of reimplementing a lite form of preg_match() we better should use preg_match() directly. The attached patch converts the pattern into a regular expression and does the matching using preg_match().
Having to copy round about 1800 files in a <copy /> task it took 29.5 seconds using phing 2.3.3. With the patch applied the runtime droped to 18.9 seconds.
I suppose the method matchPatternStart() could be optimized as well but I couldn't quite understand it's intended purpose so I didn't touch it. As far as I can see in the cachegrind.out, it didn't even get invoked.

