|
A very non-technical description of how the accelerator works would be to think of it as a two step process:
1. Look to see if the code can be sped up
2. Speed the code up if it can be
Step 1 represents a time overhead associated with having the accelerator on.
Since the code a=1:1000 is such a simple operation, the time taken to do step 1 is large compared with doing step 2 and hence you see no benefit of having the accelerator on.
Even for more complex operations, if you know that your code will not be sped up by the accelerator/JIT then it can be advantageous to turn it off, and hence avoid the time taken to do part 1.
An simple example of a code construct where the accelerator does work is
>> feature accel on
>> clear a; a = nan(1,1000); tic; for idx = 1:1000, a(idx) = idx; end, toc
Elapsed time is 0.000072 seconds.
>> feature accel off
>> clear a; a = nan(1,1000); tic; for idx = 1:1000, a(idx) = idx; end, toc
Elapsed time is 0.001143 seconds.
Phil.
|