Matlab speed test
- From: "Gorkem " <gorkemozkaya@xxxxxxxxx>
- Date: Wed, 3 Jun 2009 22:47:01 +0000 (UTC)
Hi,
I repeated Dan Spielman's experiment for comparing speed of Matlab under 4 different modes in Matlab 2008a. In my experiment, contrary to his results, I got nearly the *same* performance no matter which of the following I chose:
* non vectorized .m code
* vectorized code,
* mex file
* java class.
Here is the website that the sample files can be downloaded:
http://www-math.mit.edu/~spielman/ECC/speedTests.html
This suggests that, going into the trouble to write mex file does not help to improve speed in such a long for loop of adding 10^8 random numbers. I doubt that it is true in general. What might be special here?
I am especially curious about how using Java classes improve performance, when vectorizing the code is not possible. It gave the worst performance in my experiment. Is it true in general?
I append the sample output. I would appreciate your opinion.
Gorkem
n = 1e8
n =
100000000
tic, speedTest(n),toc
ans =
4.9999e+07
Elapsed time is 7.306400 seconds.
tic, speedTest2(n),toc
ans =
4.9999e+07
Elapsed time is 7.327862 seconds.
tic, mex_speedTest(n),toc
ans =
5.0001e+07
Elapsed time is 6.271364 seconds.
import SpeedTest
s = SpeedTest
s =
SpeedTest@15e3abb
tic, s.sumRand(n),toc
ans =
4.9993e+07
Elapsed time is 8.452087 seconds.
.
- Follow-Ups:
- Re: Matlab speed test
- From: James Tursa
- Re: Matlab speed test
- From: Matt Fig
- Re: Matlab speed test
- Prev by Date: Re: having dlls when using mcc to generate an exec file
- Next by Date: Re: file length
- Previous by thread: one question for GA optimization toolbox
- Next by thread: Re: Matlab speed test
- Index(es):
Relevant Pages
|
Loading