Time Measurement & Optimization

Mathematica's symbolic timing framework allows timing information not only to be analyzed but also to be used in the structure of algorithms. Mathematica provides functions to allow programmers to take advantage of the same kinds of powerful optimizations as Mathematica's carefully tuned internal code.


TimeConstrained run a command for at most a specified time

Timing CPU time to run a command within the Mathematica kernel

AbsoluteTiming total wall-clock time to run a command

TimeUsed ▪ SessionTime ▪ AbsoluteTime ▪ $TimeUnit

Time Optimizations

N use approximate rather than exact numbers

Compile compile a numeric function into byte or machine code

Dispatch preprocess large lists of rules

Hash find a numeric hash code for any expression

DumpSave save data in .mx native Mathematica format

$IterationLimit ▪ WorkingPrecision ▪ PerformanceGoal ▪ Method

Low-Level Functions

Refresh ▪ ClearSystemCache ▪ SystemOptions

New to Mathematica? Find your learning path »
Have a question? Ask support »