On 5/26/14, 7:59 PM, Vladimir Batov wrote:
Vladimir Batov wrote
Jeroen Habraken wrote
Vladimir Batov wrote Or I'll just run raw Spirit.Qi example from http://www.kumobius.com/2013/08/c-string-to-int/
That's a nice solution, and should save quite a bit of headache. Deployed the above code directly in a loop and via converter. Ubuntu 14.04. gcc 4.8.2. Compiled with -O3. Ran te test quite a few times: str-to-int spirit: raw/cnv=0.89/0.89 seconds. str-to-int spirit: raw/cnv=0.89/0.89 seconds. str-to-int spirit: raw/cnv=0.89/0.89 seconds. str-to-int spirit: raw/cnv=0.89/0.89 seconds.
The code to review is in the post_review branch. Corrections welcome.
For comparison:
str-to-int spirit: raw/cnv=0.89/0.89 seconds. str-to-int: strtol/scanf/lcast/sstream=2.49/9.71/3.78/9.78 seconds.
impressive. Although getting spirit-related code to compile takes so-o-o-o many times longer. :-)
Yeah, the compiler will have to travel to the north pole and ask some elves to fully optimize the code ;-) In the end, it will be worth it. Promise! There's an even faster solution, but the result will always be 42. I'm not sure if you want that :-/ Regards, -- Joel de Guzman http://www.ciere.com http://boost-spirit.com http://www.cycfi.com/