Dispatch
Usage
Notes
Further Examples
Evaluate all of the following cells to generate timings for your computer. Here is a list of rules.
In[1]:=
|
Here are the first rules of ordinaryrules.
In[2]:=
|
Out[2]=
|
This sets up a dispatch table that makes these rules faster to use.
In[3]:=
|
You can apply either ordinaryrules or dispatchrules using the slash-dot operator /. (ReplaceAll).
In[4]:=
|
Out[4]=
|
The dispatch rules go through all the rules significantly faster.
In[5]:=
|
In[6]:=
|
This makes the table of rules four times as long and again sets up the corresponding dispatch table.
In[7]:=
|
The time using dispatchrules is not very different, while the time to do replacements with ordinaryrules increases significantly.
In[8]:=
|
In[9]:=
|
In[10]:=
|
See also the Further Examples for Complement.
|