Difference Elapsed time program between two matlab versions ?!!

Why the same program
in MATLAB 2017a : Elapsed time is 0.066801 seconds.
and
in MATLAB 2007b : Elapsed time is 0.005830 seconds.
There is a big difference !

1 Comment

What is your question? Without seeing, which code you run, the best answer is currently: Yes, this is a difference.

Sign in to comment.

 Accepted Answer

Sure, I am growing older, I am running slower, :).
Seriously, if that is all the time it takes to run your program in the two versions of MATLAB, I would say "forget it".
If it is just a small snip of your code and you need to run it thousands of times, then you can run "profile" to find it out. see "help profile".
Or you can contact Mathworks' tech support for help. They would be very interested in any use case that shows the opposite trend of their optimization.

5 Comments

your answer is not very convincing whether it's a whole code or a piece of code; that does not change the fact that the execution time is slower on 2017 (what I sensed, so I put my matlab 2007 to compare)
if you had told me the configuration due to the software, it is possible
Usually the later version is faster than the older version. But sometimes the optimization carries an overhead so you might see an execution time increase.
What I meant was that it was not worth to pursue if the total elapse time for your program was 0.06 or 0.006. Neither is noticeable by human. But if you are curious, then please post the code and you might get a good answer and we might all learn something new.
@Fangjun Jiang: Matlab got slower over time for many operations. Starting Matlab and running the code plot(1:10) was done a a few seconds in Matlab 5.3, but now I can drink my cup of coffee.
But other calculations are much faster now, e.g. if they are multi-threaded. The JIT acceleration optimizes loops on the fly, but of course this costs some time at the startup of the function. Therefore running a function once can be slower, but calling it in a loop is substantially faster. In consequence a single tic/toc measurement i8s not sufficient, but e.g. timeit gives more accurate results.
@Fangjun Jiang
But why does the code matter, for me it's part of the program, the code itself is executed the same way as it was in Matlab 2007 or 2017, but it's faster, certainly not perceptible, but if on each part of program, there is this slowness, then it will be likely to have a consequence even at the launch of Matlab software, between 2007 and 2017, there is a difference a difference I added for comparison Matlab 2015a, it is close to 2017a
@Jan
I agree, this could be a reason
There are many potential reasons why code may have slowed down in a later release. Off the top of my head:
  1. We introduced a bug in a later release that slowed down the code.
  2. We fixed a bug in a later release and the corrected code is slower than the wrong code.
  3. We modified one or more of the functions you call to increase its capabilities, and that increase in capability slowed the code down.
  4. You're running the code on a different OS or a machine with a different processor and so comparing apples and oranges.
  5. You started the older release and timed the code before starting the newer release, which would give the newer release less memory with which to work and caused it to swap (or to swap sooner.)
  6. Your code slowed down by a very, very small amount of time and the sheer number of times you run that code in a for loop magnified the effect of that slowdown.
Without seeing the code, it will be impossible to determine whether the slowdown is a result of one of these reasons or something else entirely. If you're unwilling or unable to post a small section of your code here, I second Fangjun's suggestion to contact Technical Support. You can contact Support using the Contact Us link in the upper-right corner of this page.

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!