
14 Apr
2016
14 Apr
'16
11:53 a.m.
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.