performance of gather/scatter with different types of indexes
Kay F. Jahnke
[please enable javascript to see the address]
Mon May 15 09:30:11 CEST 2017
Hi all!
Given a simdized type ST, I noticed recently that, apart from using
ST::IndexType (which uses int) for gather/scatter operations, I can use
any type offering operator[] and holding the required number of indexes.
Initially I filed this under nice-to-have, but since the code I'm
working on produces indexes initially as ptrdiff_t (which is long on my
system), I experimentally coded passing vigra::TinyVector<ptrdiff_t,N>
as index type, vigra::TinyVector being a fixed size container type. To
my surprise, the resulting code was faster than the code using
ST::IndexType, so it looks like a win-win situation: I don't need to
safeguard against index overflow (as unlikely as that may be) and I get
faster code. Since this is just a single observation on a single system
(though it occurs both with g++ and clang++) I wonder if anyone else has
looked into this - and what causes the effect.
Kay
More information about the Vc
mailing list