开发者

Why for my case Matlab 64 bit is longer?

开发者 https://www.devze.com 2023-01-12 20:32 出处:网络
To increase the timeliness of my programs matlab, I got Windows 7 (64bit) and 64bit Matlab. and I\'ve installed on a partition of the hard disk. Unfortunately, I was shocked to see that the execution

To increase the timeliness of my programs matlab, I got Windows 7 (64bit) and 64bit Matlab. and I've installed on a partition of the hard disk. Unfortunately, I was shocked to see that the execution time of the program is longer with 64bit 开发者_如何学JAVAMatlab. I do not know what's the problem. knowing that I have a core 2 Quad processor and 3GB of RAM.


In general, 64-bit does not make code faster. It just lets you access more memory. Your code will only speed up if it was memory constrained in a 32-bit process. In Matlab, this would usually cause Out Of Memory errors, not slowdowns. And since you only have 3 GB, you probably weren't hitting the 32-bit limit of 4 GB. So you probably shouldn't expect a speedup. A slowdown is surprising, though.

Are you using object-oriented Matlab, especially the old (pre-MCOS) style? There is a known bug in 64-bit Matlab on Windows that increases the overhead of method dispatch. OO code will run slower in 64-bit Matlab than 32-bit Matlab, with the slowdown increasing with the density of method calls. In my codebase (heavily OO), it's about a 2x slowdown. That's about the magnitude you're seeing.

See Is MATLAB OOP slow or am I doing something wrong?. (It's discussed tangentially there.)

You can still run 32-bit Matlab on 64-bit Windows. (Though it's not officially supported.) This arrangement does not suffer from the method dispatch slowdown, plus it gets 4 GB of virtual memory instead of the 2 GB it would under a 32-bit OS. (Probably only useful if you have >=4GB RAM.) If the 32-bit does run faster on the exact same machine, you should report it as a bug to MathWorks; the more users that mention it, the more likely it is to get fixed.


Matlab has a built-in profiler, which is a tool that tells you how many times each function is called and how much time it takes to execute. You should use the profiler to find out where the bottle-neck is, i. e. what parts of your program take the most time.

If you do this on both the 32-bit and the 64-bit platforms, you may find out why the 64-bit version is slower.

0

精彩评论

暂无评论...
验证码 换一张
取 消