zeusdeux / re2

Automatically exported from code.google.com/p/re2
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

InlinedSearchLoop: Should Make 3 const bool param as template param #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
use

template<bool have_firstbyte, bool want_earliest_match, bool run_forward>
inline bool DFA::InlinedSearchLoop(SearchParams* params);

could force compiler to generate 8 optimized copies of the function, and this 
could avoid to write 8 wrapper functions(SearchFFF to SearchTTT).

Because compiler always regard template param as constant, even without any 
optimization.

Original issue reported on code.google.com by rock...@gmail.com on 9 Mar 2012 at 2:55

GoogleCodeExporter commented 9 years ago
I tried that but it didn't get any faster. Looks like the compiler knows what 
it is doing.

Original comment by rsc@golang.org on 10 Jan 2014 at 1:22