-
Notifications
You must be signed in to change notification settings - Fork 11
Home
MathCompile is a package that translates Wolfram Language functions into C++ code and generate dynamic libraries that can be called in Wolfram Language.
The primary usage of MathCompile is to speed up the execution of Wolfram Language code, similar to the built-in compiler. Compared to the built-in compiler, MathCompile supports functional programming better, and it implements supported functions within the package so that the compiled functions do not depend on Wolfram run-time library to run.
Here are some scenarios where you should consider using MathCompile:
- This part of the code is a performance bottleneck;
- The code does numerical calculations or string manipulations;
- The code uses loop, such as
Table
,Do
,NestList
, etc.; - The code does numerous operations on small lists.
And here are some scenarios where you cannot/do not need to use MathCompile:
- The code does symbolic computation;
- The code uses functions that are not compilable, e.g.
NIntegrate
; - The performance is limited by the functions that are already highly optimized, e.g.
Dot
; - Compilation does not provide a speed-up in profiling.
See the Guide.
See Performance Tests on some small-scale test cases. The comparisons between MathCompile and the built-in compiler can also be found.
MathCompile is still in a very early stage, where a lot of functionalities are to be implemented. Here is a incomplete list of what will possibly be added.
- performance improvements (parallelization, vectorization)
- more data structures