Re: [Cppcms-users] Moving from boost::regex to re2 and ability to go without regex checks
Brought to you by:
artyom-beilis
|
From: Artyom B. <art...@ya...> - 2013-09-30 12:20:46
|
1. First of all cppcms does not use Boost regex. Booster regex uses PCRE - check the performance against, and actually at some point I'm planning to enable PRCE compiled expressions that actually use JIT. So I suggest check against booster::regex - not boost regex 2. Have you tested what is the percent of the time that regex matching actually takes place in comparison to all around work? 3. RE2 is not developed by Google but rather hosted on google code (at least that is what I found) 4. Does RE2 has stable ABI? 5. RE2 uses FSA - that means its size may be exp(|regex|) i.e. the memory used by automata in some cases may grow exponentially depending or regex size - that is why no modern regex engines actually use FSA. 6. If you have some critical points - you can always override main() function and use your own dispatching algorithm 7. If you want generic approach - that it would be better to provide some selecting functional - i.e. lambda expression Regards Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Arsen Zahray <me...@gm...> >To: cpp...@li... >Sent: Monday, September 30, 2013 1:28 AM >Subject: [Cppcms-users] Moving from boost::regex to re2 and ability to go without regex checks > > > >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? > >------------------------------------------------------------------------------ >October Webinars: Code for Performance >Free Intel webinars can help you accelerate application performance. >Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from >the latest Intel processors and coprocessors. See abstracts and register > >http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |