I often see pprograms like this, where Int64
is an absolute performance killer on 32-bit platforms. My question is now:
If I need a specific word length for my task (in my case a RNG), is Int64
efficient on 64-bit platforms or will it still use the C-calls? And how efficient is converting an Int64
to an Int
?
on a 64bit system Int64 should be fine, I don't know for sure though.
More importantly if you're doing Crypto or random-number-generation you MUST use the data type that the algorithm says to use, also be careful of signed-ness. If you do-not do this you will have the wrong results, which might mean that your cryptography is not secure or your random number generator is not really random (RNGs are hard, and many look random but aren't).
For any other type of work use Integer wherever you can, or even better, make your program polymorphic using the Integral type-class. Then if you think your program is slower than it should be profile it to determine where you should concentrate when you try to speed it up. if you use the Integral type-class changing from Integer to Int is easy. Haskell should be smart enough to specialize (most) code that uses polymorphism to avoid overheads.
Interesting article on 64 bit performance here:
Isn’t my code going to be faster on 64-bit???
As the article states, the big bottleneck isn't the processor, it's the cache and memory I/O.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With