|
Boost Users : |
Subject: Re: [Boost-users] How to improve property_tree performance
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2010-10-13 04:09:12
On 13.10.2010 09:35, Bo Jensen wrote:
> Hi,
> I have a fairly easy record structure which I am writing to xml using
> property_tree. I am trying to figure out how to do it better, since
> the current time spend building the tree is too high.
>
> I do the following :
>
> wiptree pt;
> wiptree&tvars = pt.add(L"some.recordname",L"");
>
> for( int i = 0; i< somenumber /*say 60K*/; ++i )
> {
> wiptree&curtree = tvars.add(L"someitem",L"");
>
> curtree.add(L"<xmlattr>.name",L"some_attribute");
>
> ...
> }
>
> To me this seems reasonable. Is there a faster way to do this ? Since
> I just want to write it out and it's quite simple, I could avoid using
> property_tree and write the xml file manually. But since I read it in
> later with property_tree, then for maintainability I would like to
> read and write with the same method.
>
I've never done a performance analysis of PTree (I hardly have time to
get the docs up to date with the actual library), so I don't know what
is fast and what is slow. PTree is definitely not a fast library. I have
some ideas about how to make it faster, but that would take essentially
a reimplementation of the ptree class.
You might want to try to use only push_back() instead of add(), though.
That incurs fewer lookups and might thus improve performance.
Sebastian
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net