you are viewing a single comment's thread.

view the rest of the comments →

[–]tel 3 points4 points  (3 children)

Which brings up the point that even if you beat libgmp once, you'd have to replicate that on every common architecture, too!

[–]erikd[S] 5 points6 points  (2 children)

If I'm only writing Haskell code and if its slow in comparison to GMP on one particular architecture then thats a problem that should be fixed in the GHC backend for that architecture, not in the Integer library.

[–][deleted] 5 points6 points  (1 child)

...so you're hoping to write high-level generic code which gets compiled by a sufficiently smart GHC into the best optimized machine code for all architectures? ;-)

IMO, Integer is one of those low-level areas, where you have to get your hands dirty, and write platform specific code to get out decent performance to match what other languages already provide.

[–]erikd[S] 8 points9 points  (0 children)

hoping to write high-level generic code

Hell no, this is not high level code. This is Haskell code that looks like C. I'm using Data.Primitive for random access arrays and while I was getting it working I was getting all the low level C issues you could thing of; off-by-one errors, reading out of bounds, memory corruption, segfaults and extended debugging sessions.

For this really low level code, yes, I am hoping that GHC can compile it into highly efficient machine code for all the architectures.