Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.4.0

Request #11917 Faster regexp matching with \G instead of substr()
Submitted: 2007-08-28 11:06 UTC
From: joror Assigned: instance
Status: Closed Package: PHP_LexerGenerator (version 0.3.4)
PHP Version: 5.2.3 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2007-08-28 11:06 UTC] joror (Daan Broekhof)
Description: ------------ I noticed that the regular expressions used in the lexer were constructed in a manner of preg_match() on a substr() from a certain offset of the text. A better performing solution is to use the 'offset' parameter of preg_match(), in combination with the \G offset place identifier in the regular expression. The performance improvement is quite significant (not orders of magnitude), and it probably also reduces alot of memory swapping/usage due to the string not being chopped up at every match.

Comments

 [2007-12-02 04:40 UTC] instance (Alan Langford)
Changes integrated with other work; update is in CVS.