|
Boost : |
Subject: Re: [boost] [convert] Performance
From: Joel de Guzman (djowel_at_[hidden])
Date: 2014-06-11 06:00:59
On 6/11/14, 2:58 PM, Vladimir Batov wrote:
> 1. The changes in spirit_new_test compared to the original spirit_int_test
> were additional conversion validity checks and the std::string... the same
> way boost::cnv::spirit works. That slowed spirit_new_test some 11% compared
> to spirit_int_test. Though raw conversion speed is important
> (spirit_int_test) I do not expect it deployed like that (with no checks) in
> a realistic setting.
>
> 2. boost::cnv::spirit implements the same process-flow as spirit_new_test
> and boost::cnv::spirit was consistently 6% slower compared to raw spirit
> conversion deployment with the same functionality (spirit_new_test).
>
> Thank you, Joel, for sharing your performance testing framework.
My pleasure. I'm glad it helped. BTW, as I said before, you can use
the low-level spirit int and real parsers without going through
the compile-time consuming expression template facade. For example,
here's how integers are parsed:
Notice:
typedef extract_int<T, Radix, MinDigits, MaxDigits> extract;
return extract::call(first, last, attr_);
You only need to include:
#include <boost/spirit/home/qi/numeric/numeric_utils.hpp>
The same for unsigned ints and reals. It's all in:
boost/spirit/home/qi/numeric/
unsigned ints: http://tinyurl.com/orl62mc
floating pt: http://tinyurl.com/nu8vkhh
Rip the code in the 'parse' functions for your own use.
Then you don't need to wait 22 billion years for the compiler.
I won't be surprised if you can still save a few cycles by going
lower level, although the compiler should've optimized the extra
scaffolding already.
Regards,
-- Joel de Guzman http://www.ciere.com http://boost-spirit.com http://www.cycfi.com/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk