Boost logo

Boost :

Subject: [boost] [Block Pointer] Up to 600% faster than Shared Pointer
From: Phil Bouchard (philippeb8_at_[hidden])
Date: 2016-03-11 21:38:46


- I made the proxy explicit. Now it can be used 3 different ways:

1) Clothesline style:

block_proxy x;
block_ptr<int> v = block_ptr<int>(x, new block<int>(11));
block_ptr<int> w = block_ptr<int>(x, new block<int>(12));

2) Root style:

proxy_ptr<char[9]> u = proxy_ptr<char[9]>(new block<char[9]>());

3) Container style (very easy to write containers now):

struct list : block_proxy {
public:
     list() : root(*this) {}
     [...]
private:
     block_ptr<node> root;
};

- I removed the capacity to unify sets. Why? Because it's faster &
cleaner without it.

- If we use fastblock<>() then the speedup can go up to 600% compared to
shared_ptr<>:

new:
auto_ptr: 23174753 ns
shared_ptr: 49726615 ns
block_ptr: 7812659 ns

- Once again all the examples can be found here:
https://github.com/philippeb8/block_ptr/tree/master/example

- And the pointer itself here:
https://github.com/philippeb8/block_ptr/blob/master/include/boost/smart_ptr/block_ptr.hpp

Regards,
-Phil


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk