Subject: Re: [boost] [serialization] feedback on a possible port of the XML archive grammar to Qi
From: Bryce Lelbach aka wash (admin_at_[hidden])
Date: 2010-09-13 14:19:18
-----BEGIN PGP SIGNED MESSAGE-----
An update on this: using the multi_pass iterator decreases memory usage, but it
slows things down. IMO this is undesirable, given that Serialization XML is not
even close to being a memory hog.
I've developed a test suite for the XML grammar parser using Boost.PP, the
high_resultion_timer class in Boost.Spirit, and (ironically) Boost.Serialization
to save the results in an XML archive.
The test harness consists of a bunch of macros, a few template classes, and a
handful of utility functions. Various test variants can be produced by defining
preprocessor tokens with the parameters and invoking a macro which builds the
appropriate main() function for the test.
The test works by creating a tree of N-ary nodes of a fixed maximum depth D,
with an underlying serializable type S. Currently, only strings and integer
types can be used as the underlying type. Each node has N children; for nodes at
depth < D, the children are more nodes. Nodes at depth D have S children. (this
was a bit of a pain to implement with Boost.PP. I ended up having to implement a
preprocessor power function)
Each of the serializable types are initiated with random data using Boost.Uuid.
End of the day, a test with depth D, node arity N and underlying type S creates
a tree with N^D + N^(D-1) ... + N^0 nodes, N^D strings/integers each initiated
with a unique identifier. Currently, I've created 8 tests to be run, classified
by the total number of integers/strings created by each test: string4, int4,
string16, string16, string64, string64, string256, string256. I tried doing the
next greatest depth, string1024/int1024, but the preprocessor can't handle it.
Each individual test will create one tree, serialize it a temporary file, and
then record how long it takes xml_iarchive to load the data. The test program
will then look for an existing xml result archive (each test uses it's own
result archive), and create a new result archive if an existing one isn't found.
Stored in the archive is a serialized std::list containing accumulated test
results. The compiler/platform that tests are performed on is serialized into
the archive and the test will throw an exception if they don't match, e.g. if
you attempt to combine results performed on a Windows machine with those
performed on Linux.
I still need to write a Jamfile to run all the tests multiple times. I also need
to write a program to load the std::list of results from the finalized result
archives and accumulate the data. I should finish that today, and then I'll run
the performance test on the Qi grammar (the one without multi_pass) and the
It occurs to me that I might have overdone this a little bit :p.
- - Bryce Lelbach
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk