Mathlink performance and task switches
- To: mathgroup at smc.vnet.net
- Subject: [mg41827] Mathlink performance and task switches
- From: Bruno Daniel <bruno.daniel at hadiko.de>
- Date: Fri, 6 Jun 2003 09:50:59 -0400 (EDT)
- Organization: University of Karlsruhe, Germany
- Sender: owner-wri-mathgroup at wolfram.com
Dear colleagues I'm worried about task switches limiting the performance of Mathlink functions that are either short or need to call back the MathKernel for Mathematica functions. Unfortunately, such implementations in general aren't faster on faster computers, because of the design of multitasking systems: A Mathlink call needs about at least half a millisecond independent of the hardware. This makes it impossible to speed up short functions (or functions involving calls to other Mathematica functions) by recoding them in C or C++. Task switches could be avoided if the C-function was loaded as a DLL directly into the Kernel, just like the Mathlink-DLL itself ml32i2.dll is. I wonder why this isn't possible in Mathematica. I think in order to enable it, one would only have to extend the Mathlink code (especially the DLL ml32i2.dll), not the Mathematica code itself. I noticed that it's easy to replace this library by another version (e.g. the version in AddOns\MathLink\DeveloperKit\Windows\AlternativeComponents\DebugLibraries\). A new version of the Mathlink-DLL could on its part load the C-function as a DLL to its executable and thus to the Mathematica-Kernel. So no change of the Kernel would be needed. What do you think of this idea? Is there any way to license the Mathlink source code for realising this implementation of s-functions in Mathematica? Best regards Bruno Daniel