Re: [eigen] Signed or unsigned indexing |

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Signed or unsigned indexing*From*: François Fayard <fayard@xxxxxxxxxxxxx>*Date*: Fri, 20 Jan 2017 20:45:31 +0100

My experience is to always take Andrei's advices with a grain of salt: - For the pointer/index difference, I have never been able to measure any difference in between the 2. I'll be glad to get a sample code where one can measure any difference. - Once the war of signed/unsigned comes to an end, there is also the problem of 32/64 bits integers on a 64-bit machine. If you have bandwidth problems, or vectorized code, the choice is obvious: use 32-bits indices. But what should you do in other cases? One has to know that when if p is a pointer and k is a 32-bit integer, to get the address of p[k] one need to convert first k to a 64-bit integer. So, you might think that using 64-bit indices is better on x86-64. I even found a very contrived benchmark where it is indeed more efficient. But for almost every code, it just does not make any difference. Andrei Alexandrescu claims that it is better to use 32 bits integers because Intel processors have more ports that can work on them, so it increases instruction level parallelism. I did not try too hard, but I have never been able to find a benchmark that shows a difference. So be careful with Andrei. His claims are extremely difficult to check. > On 20 Jan 2017, at 19:51, Martin Beeger <martin.beeger@xxxxxxxxx> wrote: > > * Andrej Alexandrescu pointed out that whether using indices or pointers in algorithmic loops is faster seems to change every five years or so. That means, that using indices instead of pointers is a valid strategy and may increase your performance.

**Follow-Ups**:**Re: [eigen] Signed or unsigned indexing***From:*Gael Guennebaud

**References**:**[eigen] Signed or unsigned indexing***From:*Henrik Mannerström

**Re: [eigen] Signed or unsigned indexing***From:*Benoit Jacob

**Re: [eigen] Signed or unsigned indexing***From:*Francois Fayard

**Re: [eigen] Signed or unsigned indexing***From:*Mark Borgerding

**Re: [eigen] Signed or unsigned indexing***From:*Martin Beeger

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Signed or unsigned indexing** - Next by Date:
**Re: [eigen] Signed or unsigned indexing** - Previous by thread:
**Re: [eigen] Signed or unsigned indexing** - Next by thread:
**Re: [eigen] Signed or unsigned indexing**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |