|
Boost Users : |
Subject: Re: [Boost-users] How to improve property_tree performance
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2010-10-13 04:33:06
On 13.10.2010 10:15, Bo Jensen wrote:
>
> I tried that, it was only slightly faster. I also tried to do a bunch
> of independent trees and then merge them later, but still same speed.
> Is it correct, that you can not choose the underlying storage method
> or preallocate some space ? In my case I know exactly the sizes of
> each tree and number of items.
>
No, because of the way PTree is structured at the high level (nesting
trees where each branch can be treated as an independent tree),
providing generic allocator support is impractical. Internally, a tree
node consists of its local value and a node-based container of children,
so preallocation through an interface would only be able to provide
storage for that particular node, and would also require a special
allocator.
However, if you want to try the performance effect of using a stateless
Boost Pool allocator, I believe all you have to do is add it to the
base_container typedef in
boost/property_tree/detail/ptree_implementation.hpp, near the top. See
that big multi_index_container? That's the storage for child nodes. If
you give it an alternative (stateless!) allocator, it will be used.
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