Re: [LAD] Integer performance

2015-05-03 Thread Fons Adriaensen
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

Re: [LAD] Integer performance

2015-05-03 Thread Will Godfrey
On Sat, 2 May 2015 20:53:15 + Fons Adriaensen f...@linuxaudio.org wrote: On Sat, May 02, 2015 at 08:57:25PM +0100, Will Godfrey wrote: What masking? Presumably bits have to be masked when being set or read to provide the boolean action. I wouldn't expect true single bit direct

Re: [LAD] Integer performance

2015-05-03 Thread Florian Weimer
* Will Godfrey: Just a curious thought... If you are using only small values is there really any benefit in using chars and shorts rather than just using integers everywhere and letting the compiler sort it out? Many languages do not actually support arithmetic on chars and shorts, but

Re: [LAD] Integer performance

2015-05-03 Thread Will J Godfrey
On Sun, 03 May 2015 21:36:25 +0200 Florian Weimer f...@deneb.enyo.de wrote: * Will Godfrey: Just a curious thought... If you are using only small values is there really any benefit in using chars and shorts rather than just using integers everywhere and letting the compiler sort it

Re: [LAD] Integer performance

2015-05-02 Thread Clemens Ladisch
Will Godfrey wrote: If you are using only small values is there really any benefit in using chars and shorts rather than just using integers everywhere and letting the compiler sort it out? That depends on the CPU architecture. Which is why stdint.h defines types like int16_fast_t. Also,

[LAD] Integer performance

2015-05-02 Thread Will Godfrey
Just a curious thought... If you are using only small values is there really any benefit in using chars and shorts rather than just using integers everywhere and letting the compiler sort it out? Also, would bool actually have an extra cost due to masking needs? Obviously large blocks of data

Re: [LAD] Integer performance

2015-05-02 Thread Fons Adriaensen
On Sat, May 02, 2015 at 08:57:25PM +0100, Will Godfrey wrote: What masking? Presumably bits have to be masked when being set or read to provide the boolean action. I wouldn't expect true single bit direct storage to be available. No, the compiler will use one of the available int sizes

Re: [LAD] Integer performance

2015-05-02 Thread Will Godfrey
On Sat, 02 May 2015 21:06:40 +0200 Clemens Ladisch clem...@ladisch.de wrote: Will Godfrey wrote: If you are using only small values is there really any benefit in using chars and shorts rather than just using integers everywhere and letting the compiler sort it out? That depends