Eric Niebler wrote:
Joel de Guzman wrote:
Eric Niebler wrote:
Joel de Guzman wrote:
Eric Niebler wrote:
Time taken to construct the ET and traverse it was measured. The
winner by a wide margin is (3) segmented proto.
Great! It would be nice if the 1) time taken to construct the ET
and 2) the time to traverse it, are reported separately.
What is it about Spirit's usage scenario that makes traversal time
more important than ET construction time?
You spend more time traversing the nodes than in the one-time-only
construction. That's why. Consider a trivial parser:
parse(f,l, int_ >> *(',' >> int_));
You construct the parser only once, but you traverse the parser nodes
N times. And N can be significant in a lot of cases. Megabytes of
stuff to parse is not unimaginable.
Oh, of course. Duh, I knew that. :-) In that case I tend to agree with
you -- it's likely that the cost of the indirections would catch up to
us in the long run.
I just reran the test with an interesting twist. Rather than use a
segmented algorithm to traverse the proto parse tree directly, I added a
2nd phase transformation to deep-copy and flatten the ET tree. So that's
a zero-copy ET construction followed by a single deep-copy and flatten.
That is benchmarked against Spirit2's incremental flattening during the
first ET phase. Results below:
// MSVC8
Short test ...
80
80
Fusion list time : 3.73274e-009
Flattened proto time : 3.65824e-009
Long test ...
480
480
Fusion list time : 2.86484e-006
Flattened proto time : 9.06944e-007
// GCC
Short test ...
80
80
Fusion list time : 3.77178e-07
Flattened proto time : 2.77042e-07
Long test ...
480
480
Fusion list time : 1.00708e-05
Flattened proto time : 2.17819e-06
In all cases, flattening all at once with a proto 2nd phase is faster
than the incremental flattening approach taken by Spirit2. And the
larger the ET tree, the better a proto 2nd phase looks.
This is a promising direction. You get extra perf *and* the flat
sequences you want, I get the simple and generic proto I want, and it
doesn't require that we extend Fusion to support segmentation. (But we
should, anyway. ;-)
This is an interesting twist, indeed! Very cool! But, yeah,
we should still support segmentation. You already made me
feel in love with it :)
Regards,
--
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642