
On 28 Jul 2009, at 08:16, OvermindDL1 wrote:
On Mon, Jul 27, 2009 at 10:34 PM, OvermindDL1<overminddl1@gmail.com> wrote:
On Mon, Jul 27, 2009 at 6:17 PM, OvermindDL1<overminddl1@gmail.com> wrote:
/* snip */
I did a quick first test at work, just a quick compile, got some errors, and quite frankly I do not know how this compiled in gcc either. First error is: 1>r:\programming_projects\spirit_price\price_parsing\main.cpp(545) : error C2373: '_input' : redefinition; different type modifiers 1> r:\programming_projects\spirit_price\price_parsing \main.cpp(544) : see declaration of '_input'
The relevant code is: template <class T> T extract(char const * & _input, char const * _description, std::string const & _input);
Why do the first and last function params have the same name (_input)? And which one is the real input? Based upon line 566, I changed the last _input to _value and that error (and one other) is now gone. Hmm, actually the third error is gone too. Now I am getting lots of Warnings (as errors since I by default have warnings treated as errors) about double to int64_t cast, both in your normal code on line 730
Also, I added a: tests.reserve(450000); right before the load_tests call, that changed the load_tests time from like 10 seconds to about 2 seconds on my system.
Also, why are you using time(0), that only has second accuracy?
The mailing list seems to be taking a very long while to send the message, so here it is again, but the attachment in the main.cpp file only, not the test_inputs.dat file (which, when zipped, is over 350kb). So get the test_inputs.dat from the link in the post prior to mine, and use the main.cpp that is attached to this post. Here is the message I sent as well, perhaps it will come through eventually:
Okay, I basically just copy/pasted my thread-safe version of my spirit parser over and ran it, it returned bad parse with like 13/9 or something like that. According to the documentation in the original cpp file, only "1", "1 2/3", or "1.2" are valid, not "2/3", so I changed it to support that and ran it again, it parsed successfully with all numbers in your tests matching successfully. Here is what it printed, using the horribly inaccurate time function: Testing string-based parsing Testing Xpressive-based parsing Testing Spirit-based parsing string parsing: 8s xpressive parsing: 33s spirit parsing: 6s
If you do not mind, I am going to add a millisecond accuracy testing framework (test.hpp from the boost examples) to the file and change all the nasty time calls to it for a more reliable reading.
OvermindDL1 - does my timer functionality not work? Can you try using that instead? If it's no good please let me know - and I can improve it. The whole point of the timer code is to obtain reliable confidence bounds for precisely this kind of optimisation application in an efficient manner. It hurts seeing absolute times used to compare things without any idea of their precision or accuracy! Cheers, -ed ------------------------------------------------ "No more boom and bust." -- Dr. J. G. Brown, 1997