[Cppcms-users] Moving from boost::regex to re2 and ability to go without regex checks
Brought to you by:
artyom-beilis
|
From: Arsen Z. <me...@gm...> - 2013-09-29 22:28:40
|
Hey. I'd like to discuss a possibility of changing the way the app handles regex evaluations. Some time ago, I heavily used regex. That was before I found out, that it was killing my app's performance. After I got rid of it, my app's speed improved by at least 10 times. So, here are few suggestions I'd like to discuss implementing: 1. Move from boost::regex (the app seems to be using that if I'm not mistaken) to re2 (it was developed by google for performance critical apps, and it seems to do the job well enough). re2 doesn't compile for windows, but the vast majority of cppcms users will use framework under linux (me included) 2. Give the users ability to go without regex altogether. Let us just pass along function pointers instead of regex strings. Performance wise, there is nothing that beats a function pointer. I've set up some benchmarks to demonstrate what I mean. Build commands: g++ -std=c++11 -Wall -fexceptions -g -c main.cpp -o main.o g++ -o regex-tests main.o -lre2 -lbooster -lboost_regex I'm attaching the source, and here are the test results: RE2: 326069 boost::regex: 2164850 function pointers; 27878 Because cppcms is going to be used by those, who want top performance for the apps, I think that this is a way forward for the library. What do you guys think? |