Anyone has experience measuring glibc regexp functions?
Are there any generic tests I need to run to make such a measurements (in addition to testing the exact patterns I intend to search)?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Regular expression performance depends much on which regular expression you’re using and which data you’re applying it to. There’s little point in just benchmarking a bunch of regular expressions. You have to compare actual code using a regex and your actual plain C alternative on your actual data.
As a rule of thumb, I’d say that if you already have properly functioning procedural code to do the text matching you need, just leave that in place. If you don’t have that code yet, I recommend to start with regexes as you’ll save yourself much development time (assuming you’re familiar with regexes). You can probably write procedural code that is faster than the equivalent regex, but the difference isn’t going to be dramatic. The effort of writing and maintaining the procedural code will be significantly higher than using a regex.