Often – but not always – LLVM is smart enough to figure out that if you're
doing a computation that does Int8 --> Int64 --> Int8 that it can just be
done as all Int8 values, if that's even possible. The biggest win from
using Int8 array storage is that more data fits into cache. Once you're in
registers, using Int8 isn't especially helpful, but you do fix 8 times as
many values in cache if your arrays are Int8 arrays instead of Int64.


On Sun, Mar 30, 2014 at 8:06 AM, andrew cooke <[email protected]> wrote:

> in my experience Int64 (native ints) are faster than anything else unless
> I need to keep an array in cache (eg a lookup table that's smaller than L1
> when I use Int8).
>
> It's possible the code was slower because of conversions between different
> types (since not all values could be Int8) rather than the Int8 operations
> themselves.  Julia's automatic promotion probably doesn't help here:
>
> julia> typeof(0x1+0x1)
> Uint64
>
> Andrew
>
>
>
> On Sunday, 30 March 2014 03:27:17 UTC-3, Freddy Chua wrote:
>>
>> Hi,
>>
>> I have a question. Suppose the data I have are only small integer values
>> in the range of 1-10. Should I use Int64 or Int8. Using Int64 would be
>> consistent with my system word size and would likely be faster. But using
>> Int8 would definitely save more memory.
>>
>> So, which should I use?
>>
>

Reply via email to