[LAD] Integer performance

Fons Adriaensen fons at linuxaudio.org
Sun May 3 21:28:52 UTC 2015


On Sun, May 03, 2015 at 09:02:55PM +0100, Will Godfrey wrote:

> > For arrays of bool, GCC uses a char for each bool.
> 
> Ouch! that could get expensive - although I doubt it will ever be an issue for
> me. Certainly worth remembering though.

It's a reasonable compromise. Very few application fields use large
arrays of booleans.

Cryptography is one where logic rather than computation is dominant,
but most algorithms are defined on bytes or words anyway. One trick
used there is to run 32 or 64 copies in parallel by using logical
operations on integers. Provided the parallelism can be exploited,
these are often the fastest versions of crypto algorithms.

Languages such as Matlab and numpy can use large multidimensional
boolean arrays. But they always represent a property of the elements
of a numerical array, so that one will take most of the space.

Ciao,

-- 
FA

A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)



More information about the Linux-audio-dev mailing list