Re: Qi Symbols parser performance

Joel de Guzman <[email protected]> Mon, 15 Jan 2018 12:48:28 +0800
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
On 14/01/2018 11:07 AM, Seth wrote:
> On 13-01-18 19:36, Stephan Menzel wrote:
>> In fact, I have just browsed through them and I haven't seen
>> any example. Normally they are just inlined, which is also a creation on
>> demand.
> Creating the grammar is usually compile-time for the actual parser
> expressions. It's just in your case you are building the Trie and that
> allocates memory, of couse it's going to matter.
> 
> I agree. Though many examples are small, the larger samples should do
> the right thing.
> 
> 
> Correct way:
> 
> http://www.boost.org/doc/libs/1_66_0/libs/spirit/example/qi/employee.cpp
> 
> http://www.boost.org/doc/libs/1_66_0/libs/spirit/example/qi/calc_utree.cpp
> 
> 
> Unexpected incorrect way:
> 
> http://www.boost.org/doc/libs/1_66_0/libs/spirit/example/qi/compiler_tutorial/calc4.cpp
> etc. (huh)

Well, one could argue that this parser is not inside a tight loop and the
bottle neck here is actually std::getline. But I get your point. and it's
easy enough to move the grammar instantiation outside the loop. PR very
welcome if anyone cares about this.

Regards,
-- 
Joel de Guzman
http://www.ciere.com
http://boost-spirit.com
http://www.cycfi.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot