Opened 4 years ago

Closed 4 years ago

#13615 closed Bugs (invalid)

Could the performance of spirit::qi::parse() be much worse than std::stod()?

Reported by: Mario Emmenlauer <mario@…> Owned by: Joel de Guzman
Milestone: To Be Determined Component: spirit
Version: Boost 1.67.0 Severity: Optimization
Keywords: parser, stod, string, double, performance Cc:

Description

When converting from std::string to numerical formats, I found spirit::qi::parse() to be of superior performance compared to more standard commands like atof() or std::stod() on Linux. Typically it can be at least 4x faster, sometimes even more. This is true on several versions and flavours of Linux.

However I get quite different results on Windows with MSVC, MinGW and the Intel Compiler and on MacOSX.

On Windows and MacOSX spirit::qi::parse() is typically between 2 and 5 times slower than atof() and std::stod() according to my benchmark. I understand that benchmarks are always a bit flaky, but I fail to understand such a huge difference.

Change History (2)

comment:1 by Mario Emmenlauer <mario@…>, 4 years ago

Please close this ticket as invalid.

I was running the benchmark as part of testing. And testing uses a debug build. When switching the benchmark to release mode, boost::spirit::qi is the fastest parser of the parsers that perform error checking. Only atof() can be faster sometimes, but since it does not give any guarantee about correctenss, I do not include it in the valid results. Thanks for the nice library!

comment:2 by Joel de Guzman, 4 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.