improve implementation of loadDataFromPtrEx
improve implementation of loadDataFromPtrEx

Avoid some excessive copying when marshaling values to and from C. Instead of allocating temporary arrays, then copying these to ByteStrings, we can do a little better.

  * The error log is no longer returned as a ByteString. So, just marshal it directly to a Haskell String for the error message.

  * The info log is allocated as a foreign pointer and the C function writes directly into it. We still need on O(n) operation to gets its length so it can be trimmed when wrapping into a ByteString, but there is no additional copy.

  * Either operation is only done when required, on the success or failure branch.

phaazon/cuda,mwu-tow/cuda,phaazon/cuda,phaazon/cuda