Opened 7 months ago

Closed 8 weeks 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:


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 Changed 7 months ago by Mario Emmenlauer <mario@…>

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 Changed 8 weeks ago by Joel de Guzman

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