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 Sankel
Sankel Software
585 617 4748 (Office)

Boost list run by bdawes at, gregod at, cpdaniel at, john at