Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Why is it that MATLAB runs slower with feature accel on???

Subject: Why is it that MATLAB runs slower with feature accel on???

From: Diego Zegarra

Date: 18 Feb, 2009 03:33:02

Message: 1 of 5

Simple example,

>> feature accel on
>> tic;a=1:1000;toc
Elapsed time is 0.000241 seconds.
>> feature accel off
>> tic;a=1:1000;toc
Elapsed time is 0.000071 seconds.

Any reasons?

Subject: Why is it that MATLAB runs slower with feature accel on???

From: Matt Fig

Date: 18 Feb, 2009 03:48:02

Message: 2 of 5

What version are you running. On my PC with 2007a, the times are nearly identical to the digit. Are you doing multiple runs to check for times, unlike in the example you show?




_]`vXQ\^QUQof[e_XoU*o_veoXd_Sd}QYo\]R0_SioWQRo^YQU5`od_UI=Q

Subject: Why is it that MATLAB runs slower with feature accel on???

From: Matt Fig

Date: 18 Feb, 2009 03:48:03

Message: 3 of 5

What version are you running. On my PC with 2007a, the times are nearly identical to the digit. Are you doing multiple runs to check for times, unlike in the example you show?




_]`vXQ\^QUQof[e_XoU*o_veoXd_Sd}QYo\]R0_SioWQRo^YQU5`od_UI=Q

Subject: Why is it that MATLAB runs slower with feature accel on???

From: Phil Goddard

Date: 18 Feb, 2009 04:13:01

Message: 4 of 5


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.

Subject: Why is it that MATLAB runs slower with feature accel on???

From: Diego Zegarra

Date: 18 Feb, 2009 04:26:01

Message: 5 of 5

version R2008a 7.6

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us