Skip to main content

MathLink (WSTP) vs LibraryLink performance



Has anyone benchmarked LibraryLink vs MathLink when passing large arrays?


Specifically I would like to know how performance compares when using the following to pass and return a large array:



  • LibraryLink with {Real, _, Automatic} argument and return types

  • LibraryLink with LinkObject argument and return types

  • MathLink (WSTP) with MLPutRealArray() and MLGetRealArray() (or equivalent), through LinkProtocol -> "SharedMemory".


I suspect that someone has already done this benchmarking. If not, I'll self-answer in a few days.


Knowing how great the LibraryLink advantage is will help in deciding when it's worth it to sacrifice MathLink's flexibility for performance.




Comments