pfalcon / re1.5

re1, the unbloated regexp engine by Russ Cox, elaborated to be useful for real-world applications
BSD 3-Clause "New" or "Revised" License
42 stars 4 forks source link

Implement named character classes, \d \D \s \S \w \W. #3

Closed dpgeorge closed 9 years ago

dpgeorge commented 9 years ago

This is a better implementation that the previous one (PR #2). It saves on code size (x64 and Thumb2 tested), RAM (since the compiled code for named classe is now only 2 bytes per class) and is more efficient in execution (since the execution of _re1_5_namedclassmatch is quicker at matching the classes than interpreting bytecode).

pfalcon commented 9 years ago

Well, I wouldn't expect this to be less code size, but if you say it is, merged this one.

pfalcon commented 9 years ago

Wait-wait, maintaining this lib is a bit of chore, because any change requires updating 5 engines. This patch updates just one engine. Still sure that size calculations are right? ;-) Let me know if you can update other engines or if it makes sense to switch to safer #2 implementation.

dpgeorge commented 9 years ago

Yes, size calculation is correct :) It's a bit surprising, but version 1 had a few static strings and other logic which was large in code size.