Re: EXE is Slower than M-File
- From: "Dave Robinson" <dave.robinson@xxxxxxxxxxxxx>
- Date: Thu, 12 Mar 2009 17:06:01 +0000 (UTC)
"Seth" <Snick.NOSPAM@xxxxxxxxxxxxx> wrote in message <gpbb8s$opk$1@xxxxxxxxxxxxxxxxxx>...
Jos,
Several points:
1. I've read MANY posts saying that compiled code is somewhat faster than not
2. I've compiled 10's of other functions I've written in Matlab with speed being equal to or faster than original m-code.
3. I don't care if it is faster, I just didn't expect it to be almost 5X slower.
Thanks,
-Seth
-------------------
"Jos " <#10584@xxxxxxxxxxxxxxxx> wrote in message <gpbari$qoa$1@xxxxxxxxxxxxxxxxxx>...
"Seth" <Snick.NOSPAM@xxxxxxxxxxxxx> wrote in message <gpb9ti$m86$1@xxxxxxxxxxxxxxxxxx>...
I have a Matlab function which I compiled. The problem is now it runs much slower than the original M-code. No variabiles are passed in or out of the function. For example, if I execute these codes from Matlab command line:
%Case #1 - Run Compiled, Standalone Program
tic
for i=1:10
!PROGRAM
end
toc
%Case #2 - Run M-code (not compiled)
tic
for i=1:10
PROGRAM
end
toc
I get:
Case #1 time = 51.97 seconds
Case #2 time = 11.97 seconds
Any idea what's going on? Is this just inherent overhead associated with the EXE? What type of things do I need to look at to speed up the EXE? Not sure where to start...
The code does some math and some file I/O.
Thanks!
Why do you expect that compiled code is faster than native matlab code in the first place?
Jos
Its a long time since I played with the Matlab compiler, so I might be having a senior moment - so excuse me if I am spouting rubbish. But I vaguely remember that when you first run a compiled application it takes ages to initialize itself, but after that it runs at about the same speed as the development environment.
Perhaps you Guru's can put me right on this
Regards
Dave Robinson
.
- References:
- EXE is Slower than M-File
- From: Seth
- Re: EXE is Slower than M-File
- From: Jos
- Re: EXE is Slower than M-File
- From: Seth
- EXE is Slower than M-File
- Prev by Date: Re: Running and Aborting external program
- Next by Date: How fast are you running your code?!
- Previous by thread: Re: EXE is Slower than M-File
- Next by thread: Re: EXE is Slower than M-File
- Index(es):
Relevant Pages
|