Subject: Re: [boost] [variant] address of a variant type from the address ofitssub-object?
From: Peter Dimov (lists_at_[hidden])
Date: 2016-04-14 07:53:50


Andrzej Krzemienski wrote:
> But, I am trying to optimize a function that I believe is slower than
> ideal, and my hypothesis is that this carrying of the additional pointer
> around is the culprit.

That's hard to believe. Copying a pointer should be insignificant compared
to the cost of the dispatch. What does the profiler say?

You should probably spell out the apply_visitor() call by hand inline; in
addition to eliminating the pointer copy, this would allow you to experiment
with, say, reordering the tests from most frequent to least frequent.