Boost logo

Boost :

Subject: [boost] Boost.Variant swap performance
From: David Sankel (camior_at_[hidden])
Date: 2012-04-20 17:57:25


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)



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