Re: Design/structure X3 parser more like Qi parser

Larry Evans <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
On 12/20/2016 03:02 AM, Sandro Pirkwieser wrote:
 > Hi Larry,
 >
 >> This doesn't use BOOST_SPIRIT_DEFINE, and I don't think it can because
 >> that would generate one or more parse_rule's template functions within
 >> the make_csv_parser function.  Is that right?
 >> If so, then wouldn't that make this method slower to compile than if
 >> BOOST_SPIRIT_DEFINE could be used?
 >
 > yes, to my knowledge using BOOST_SPIRIT_DEFINE inside a function, 
e.g. make_csv_parser, is not possible.
 > But I don't know whether this influences compile time.

According to:

https://github.com/cppljevans/spirit/blob/get_rhs/workbench/x3/rule_defns/bench.tmp

there's a significant compile-time penalty without using 
BOOST_SPIRIT_DEFINE.

The benchmark code:

https://github.com/cppljevans/spirit/blob/get_rhs/workbench/x3/rule_defns/rule_defns_bench.cpp

was run with various methods and results were tabulated in
the bench.tmp file.  The method descriptions are found in
comments to:

https://github.com/cppljevans/spirit/blob/get_rhs/workbench/x3/rule_defns/RULE2RHS_METHODS.hpp

The method:

   RULE2RHS_CTX_LIST

is the one which runs without using BOOST_SPIRIT_DEFINE.
As shown in bench.tmp, this performs worse than any other
method, by every measure, when number of rules=12.  In
particular, the elapsed time is significantly worse:

 
https://github.com/cppljevans/spirit/blob/get_rhs/workbench/x3/rule_defns/bench.tmp#L17 


Note, the code was not run with spirit, but with an
"emulation" of spirit found in the rule_defns_benchmark.cpp.
That emulation just doesn't handle attributes, but, AFAICT,
faithfully mimics what spirit does.   If someone sees where
that's not so; please let me know.

HTH.

-regards,
Larry








------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.