|
Boost : |
Subject: Re: [boost] Boost.Variant swap performance
From: David Sankel (camior_at_[hidden])
Date: 2012-04-20 18:29:12
I tried adding a Boost.Move optimized version and while this helped, I'm
still not getting O(1) performance.
void ilPushFront3( IntList & il, int i )
{
il = IntList
( std::make_pair
( i
, ::boost::move( il )
)
)
;
}
unoptimized ilPushFront: 115
unoptimized ilPushFront w/ larger list: 350
optimized ilPushFront: 217
optimized ilPushFront w/ larger list: 663
move optimized ilPushFront: 121
move optimized ilPushFront w/ larger list: 368
On Fri, Apr 20, 2012 at 3:57 PM, David Sankel <camior_at_[hidden]> wrote:
> It seems as though Boost.Variant doesn't take advantage of pointer swaps
> when it comes to use of recursive variants. In the attached file I declare
> a simple int list type and include two implementations of a function that
> adds an int to the front of a list. The first implementation, I would
> expect to be O(N) on the size of the list and the second implementation to
> be O(1) on the size of the list.
>
> Unfortunately, the output I get is:
>
> unoptimized ilPushFront: 129
> unoptimized ilPushFront w/ larger list: 363
> optimized ilPushFront: 211
> optimized ilPushFront w/ larger list: 653
>
>
> Any ideas why this might be happening?
>
> David
>
> --
> David Sankel
> Sankel Software
> www.sankelsoftware.com
> 585 617 4748 (Office)
>
-- David Sankel Sankel Software www.sankelsoftware.com 585 617 4748 (Office)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk