|
Boost : |
Subject: Re: [boost] Interest request for pointer+bitcompression optimization
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-09-07 16:25:38
----- Original Message -----
From: "Daniel Hulme" <st_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, September 07, 2009 7:46 PM
Subject: Re: [boost] Interest request for pointer+bitcompression optimization
On Mon, Sep 07, 2009 at 07:00:14PM +0200, vicente.botet wrote:
> I have recently found in the blog of Joaquin the following
> optimization consisting in embed a bit into the representation of a
> pointer. Please read it, it is not too long
> (http://bannalia.blogspot.com/2008/11/optimizing-red-black-tree-color-bits.html)
One of my colleagues wrote something similar, with get and set methods
instead of proxy classes, and we use it extensively at work. On AMD64
(and whatever the Intel name for the same thing is) pointers are always
divisible by 4, so we actually store 2 bits in each pointer.
I've also written a boost::variant-like class that uses the 2 bits to
store the which() value for up to four types of pointer (one of which
can instead be boost::blank), in order to reduce the size of my small-
buffer-optimization class. We don't use this right now because code
elsewhere in the system needs to get a reference to the pointer stored
in it, and templating the whole lot so we can pass a proxy object around
is too horrific for words.
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Hi Daniel,
Could you share the code of the variant-like class?
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk