From: Rune Allnor on 29 Jun 2010 07:32 On 29 Jun, 01:19, "Joseph Cohen" <hypergra...(a)hotmail.com> wrote: > I have an m-file function that uses a for-loop that repeats many times. Unfortunately, it runs rather slowly. I heard that transforming it into a MEX file could possibly speed it up. I tried doing this automatically using the mcc -x command, but got this message: > > rror using ==> mcc > Error: -x is no longer supported. The MATLAB Compiler no > longer generates > MEX files because there is no longer any performance > advantage to doing so: the > MATLAB JIT accelerates M-files by default. > To hide proprietary algorithms, use the PCODE functi > > Is the fact that "there is no longer any performance advantage to doing so" correct? Or should I go ahead and manually create a MEX file anyway? MEX *might* be significantly faster than matlab m code (some 10-50-100x faster is not unheard of) *provided* 1) The problem at hand is sufficiently different from what matlab is tuned to deal with (i.e. there is little linear algebra involved) 2) The MEX (C, C++ or Fortran) programmer really knows what he is doing. Don't expect to gain anything ofsignificance merely by hacking some naive C(++) code. Certainly don't expect to gain anything by applying automized tools based on naive m code. Rune |