tag:blogger.com,1999:blog-6862508.post6527762099207542770..comments2024-03-27T12:00:43.966+01:00Comments on Alex Ott's blog: boost.spirit2 vs. atoiAlex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-6862508.post-27594338021975171022010-07-12T15:54:29.007+02:002010-07-12T15:54:29.007+02:00Yes, I was pointed to this problem in other discus...Yes, I was pointed to this problem in other discussion. But spirit developers had shown, that Spirit2 faster also in other parsing examplesAlex Otthttps://www.blogger.com/profile/13001951608173211050noreply@blogger.comtag:blogger.com,1999:blog-6862508.post-47779027276697315002010-07-12T15:50:31.687+02:002010-07-12T15:50:31.687+02:00I was somewhat puzzled by the remark from "Lo...I was somewhat puzzled by the remark from "Lovely Day" on this blog (about moving 'int val=0' inside the loop). In fact your test program is somewhat flawed, if I may : in the statement 'qi::parse(nstr,nstr+6,int_,val)' the first iterator (nstr) is passed by reference and is modified by parse(). At the return point its value is (old)nstr+6 which means that all the calls to qi::parse() (but the first) operate on an empty sequence. I fixed easily the program by reinitializing nstr at each iteration. <br /><br />Your initial program gave the following result on my machine:<br /><br />atol = (10000000 rep): 00:00:00.288255<br />spirit = (10000000 rep): 00:00:00.037653<br /><br />After the fix, we have:<br /><br />atol = (10000000 rep): 00:00:00.293819<br />spirit = (10000000 rep): 00:00:00.090364<br /><br />The speedup is only 3 instead of 7, but Spirit has still the lead (Intel Xeon 4 procs, Linux x86_64, boost-1.43, gcc-4.5.0 with -O2).<br /><br />May be you already had realized the problem, but I have seen no mention of it on the web... Thanks anyhow for bringing this interesting point.Jean-Paul Rigaulthttps://www.blogger.com/profile/17048551473051636276noreply@blogger.comtag:blogger.com,1999:blog-6862508.post-49390742336673675272010-07-09T08:44:13.855+02:002010-07-09T08:44:13.855+02:00it's depends on compilation flags, please use ...it's depends on compilation flags, please use -O2 and no debugAlex Otthttps://www.blogger.com/profile/13001951608173211050noreply@blogger.comtag:blogger.com,1999:blog-6862508.post-38350637088128793582010-07-08T22:08:26.745+02:002010-07-08T22:08:26.745+02:00Alex, glad to see your test, but I copied your cod...Alex, glad to see your test, but I copied your code and run on my machine, it shows:<br />atol = (10000000 rep): 00:00:00.589094<br />spirit = (10000000 rep): 00:00:01.269398<br /><br />Any comments?HongJiang Zhuhttps://www.blogger.com/profile/05997466335134661824noreply@blogger.comtag:blogger.com,1999:blog-6862508.post-52188084487189917162010-02-03T10:47:35.779+01:002010-02-03T10:47:35.779+01:00Hi, i did test your code. And i found if "int...Hi, i did test your code. And i found if "int val=0;" is moved inside the loop, only the first parse result is correct. did i get anything wrong?Lovely Dayhttps://www.blogger.com/profile/15074870488817171660noreply@blogger.comtag:blogger.com,1999:blog-6862508.post-6125865216747344302010-01-13T18:12:01.690+01:002010-01-13T18:12:01.690+01:00Thanks Alex for this additional detail.Thanks Alex for this additional detail.Mateusz Loskothttps://www.blogger.com/profile/12641441234340682916noreply@blogger.comtag:blogger.com,1999:blog-6862508.post-13150843422115995042010-01-12T11:57:26.391+01:002010-01-12T11:57:26.391+01:00with stripped debug information, this test has siz...with stripped debug information, this test has size 56464. With many templates, it will bigger, but not so much. Biggest executable are when you put debug information into it, yes - in this case Spirit adds a lot...Alex Otthttps://www.blogger.com/profile/13001951608173211050noreply@blogger.comtag:blogger.com,1999:blog-6862508.post-80739724396658570712010-01-12T11:47:18.584+01:002010-01-12T11:47:18.584+01:00Alex,
Great, thanks in advance.
By the way, do yo...Alex,<br /><br />Great, thanks in advance.<br />By the way, do you have any observations regarding size of generated binary files, quite a concern against Spirit sometimes.Mateusz Loskothttps://www.blogger.com/profile/12641441234340682916noreply@blogger.comtag:blogger.com,1999:blog-6862508.post-72960022258478021592010-01-11T17:54:34.671+01:002010-01-11T17:54:34.671+01:00Yep, Mateuz - I also thought, that atoi will overp...Yep, Mateuz - I also thought, that atoi will overperform spirit.<br />Now I'm working on more complex test - parsing of HTTP Date string - I have manual parser in our internal project, and I also want to compare spirit2 parser with spirit.classic parserAlex Otthttps://www.blogger.com/profile/13001951608173211050noreply@blogger.comtag:blogger.com,1999:blog-6862508.post-49834919305931695612010-01-11T17:47:10.085+01:002010-01-11T17:47:10.085+01:00Alex, I've been thinking of doing similar chec...Alex, I've been thinking of doing similar checks, but due to laziness...<br />It's wonderful news confirming it's worth to consider Spirit for small things too. It doesn't bite as many may think anyway :)Mateusz Loskothttps://www.blogger.com/profile/12641441234340682916noreply@blogger.comtag:blogger.com,1999:blog-6862508.post-75439743665364531682010-01-09T01:09:56.289+01:002010-01-09T01:09:56.289+01:00Que? the meaningful parts of your numbers are off ...Que? the meaningful parts of your numbers are off the right side of the column in my very-late-model mozilla-based browwer.rainy_dayhttps://www.blogger.com/profile/14988377881664865258noreply@blogger.comtag:blogger.com,1999:blog-6862508.post-67572853984641522282010-01-07T10:51:24.815+01:002010-01-07T10:51:24.815+01:00with small modification of parser, that allow to s...with small modification of parser, that allow to skip spaces, i got following results:<br />atol = (10000000 rep): 00:00:00.411694<br />spirit = (10000000 rep): 00:00:00.112000<br />integer overflow is checked by default, as i remember...Alex Otthttps://www.blogger.com/profile/13001951608173211050noreply@blogger.comtag:blogger.com,1999:blog-6862508.post-16489019300910304642010-01-07T10:37:35.276+01:002010-01-07T10:37:35.276+01:00This post got interest here: http://www.facebook.c...This post got interest here: http://www.facebook.com/djowel?v=feed&story_fbid=276147167924Joel de Guzmanhttps://www.blogger.com/profile/02167887674977103795noreply@blogger.comtag:blogger.com,1999:blog-6862508.post-90505052209809778112010-01-07T08:50:59.700+01:002010-01-07T08:50:59.700+01:00This comment has been removed by the author.Alex Otthttps://www.blogger.com/profile/13001951608173211050noreply@blogger.comtag:blogger.com,1999:blog-6862508.post-67212836121724188542010-01-07T03:06:18.242+01:002010-01-07T03:06:18.242+01:00Are you certain that spirit's int_ parser reco...Are you certain that spirit's int_ parser recognizes the same input as atoi?Anonymoushttps://www.blogger.com/profile/18264310606911671382noreply@blogger.com