Re: EXE is Slower than M-File



"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
.



Relevant Pages

  • Re: compiling for speed-up... classdef
    ... I implemented a number of matlab classes using the new OO- ... although possible it doesn't mak sense: the compiled code will run at ... the same speed like the interpreted code, since it is not compiled to some ...
    (comp.soft-sys.matlab)
  • Re: running time/speed of .m code compiled and deployed in c
    ... Since R14 the compiled code and the interpreted ... but is interpreted by the MATLAB Component ...
    (comp.soft-sys.matlab)
  • Re: EXE is Slower than M-File
    ... I've compiled 10's of other functions I've written in Matlab with speed being equal to or faster than original m-code. ... What type of things do I need to look at to speed up the EXE? ... Why do you expect that compiled code is faster than native matlab code in the first place? ...
    (comp.soft-sys.matlab)
  • findpeaks
    ... when I use findpeaks in matlab, it works, ... when I call it from compiled code, I get the error message: ... undefined function or variable 'dspopts.findpeaks' ...
    (comp.soft-sys.matlab)
  • Re: exe file
    ... "Train my users"? ... An EXE, ... than a VBS script at doing just about anything. ... to convey the general difference between compiled code ...
    (microsoft.public.scripting.vbscript)