Matlab and OS X

I have seen a couple of threads on Matlab on OS X on this forum and I want to re-propose the issue. In particular one of the threads (about 2 years ago) stated that Matlab on OS X is not "native" and therefore it runs slower than it would run on Linux or Windows. Does anyone have information on the status of things now? I am wondering whether I should still prefer the Linux version.

Giovanni

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

In my experience, matlab

In my experience, matlab just dogs on Macs. We have an 8-core MacPro with 8GB RAM, and it runs much of matlab slower than windows or linux computers with far less impressive specs. A lot of this seems to do with the X11 version on Macs; there is another version you can download and install (don't have the name/link handy...), but it doesn't help much. Our MacPro quad-boots Leopard, XP, Vista, and Linux (Ubuntu), and the matlab bench command shows that Leopard results are by far the slowest, running Matlab 2008a. If you just need it for backend calculations that do not require much graphical presentation, then it would probably be fine, but as soon as you start doing figures or GUIs, then the situation deteriorates pretty quickly.

Of course this is just my experience, and others may tell you otherwise. I am probably bitter since the SOLE purpose of getting the MacPro for our lab was to run matlab, and a $300 single core dell desktop running vista ends up being faster. But, the general consensus seems to be that the mac version of matlab is lacking. Your mileage may vary :-).

Now that I tried it, I must

Now that I tried it, I must say I agree. The Matlab "bench" program runs around twice slower on OS X than on Windows installed in a partition of the same computer with Boot Camp.

Agree!

Oh yes! Pretty sad! I am running Matlab 2008a on Leopard and I can tell you, it sucks! When using graphics the performance deteriorates. I suspect it is x11.
BTW it is not 64 bit yet on Mac although there is a beta version. Probably we need to wait until the release of Snow Leopard, by then, hope Matlab people would fix it.

It is making me sad to see that I need to run Matlab on Windows.

Yup

Every OS X release I've tried has been woefully slow.

Sometimes it starts bogging down & I'll need to do a "clear; clc;" to get it
going again. The latter command probably isn't needed, but it's odd that when the variables are recently set, it doesn't seem to be slow... but after a while it starts to chug along even if I haven't really added anything new.

Also, using two monitors can do weird things. I used to get a lot of Java errors flying through my command window when dragging MATLAB around on my 2nd monitor. I usually just keep all my MATLAB stuff on my primary laptop monitor now.

Not last nor least, the mousewheel scrolling is heinous. When I'm using the MATLAB editor (I use TextMate mostly now w/ the MATLAB plugin) or when I'm viewing large data sets in MATLABs variable viewer, I instinctually hit the mousehweel to scroll through. Usually by the fourth scroll I slap myself in the forehead then wait 10 seconds for MATLAB to catch up.

I know there are functionality differences, but Mathematica apparently has a native version & it also has graphing capabilities that look more suitable for the modern day OS X. MATLAB's been behaving so poorly, I've been thinking about getting a copy (or maybe just get used to octave).

I'm afraid to test MATLAB in Parallels/Fusion because it might run faster than on X11...

Cheers.

Well I can confirm the

Well I can confirm the slowness of Matlab on OSX. I'm running it on a maxed out 8-core macpro with 18GB of ram. Depending on what you run things can be very slow. On the other hand, some parallellization is done automatically taking advantages of the 8-cores. However, for the moment memory usages is limted by the fact that it is just a 32bit version.

However, I do not think that X11 should be the culprit in execution times of non graphic stuff (maybe in fluent user interface use this can be an issue).

On my request list are: further parallellization and full 64bit support so I can run everything out of the system memory. A fully graphically exportable X11 session would also be nice. I learned to love working remotely in GRASS in an exported X11 session.

MATLAB Performance Issues

Hi everyone,

We would like to make MATLAB's performance on Mac OS X a higher priority, and we need your help prioritizing specific issues and concerns. Before I explain that, I'd like to dispel some myths and explain what we have been doing so far.

Most performance issues in MATLAB don't actually have to do with X11. That dependency still creates some drag on performance in certain places, but the real sources of performance trouble are elsewhere.

In the UI, MATLAB performance is most significantly impacted by Java Swing and its rendering pipeline (Graphics2D). We have been working with Apple on improving this for some time, but we may need to do something more drastic such as upgrading to Java 6 or 7 before we can see significant improvements. For Java 1.5, we have found that Sun's (non-Quartz) rendering pipeline provided better overall graphics performance for Figures, but we found when Apple switched to the Sun rendering pipeline in Java for OS X 10.5 by default, the UI "snappyness" suffered tremendously--we have a patch on our web site for working around this in older versions of MATLAB, and ship with the patch in R2008b, but using the patch means slower Graphics2D and 3D results.

We intend to modernize MATLAB graphics in a future release, which will avoid the Java rendering pipeline altogether and use OpenGL directly, and improve both the quality and performance at the same time. One of the challenges we have is whether to commit resources to squeezing performance in existing code when we know that new code replacing it is on the horizon. The trouble with our release schedule is, you may not see, from release to release, some of the things we are doing for the long term.

That said...

We made some optimizations to Figure graphics performance in R2008a, and we made optimizations to MATLAB numerics performance in R2008b, so if you are comparing an older version of MATLAB, please consider upgrading. We know that the numbers are still not where they need to be. We have also begun introducing parallel features, such as parfor, in R2008a, which allows for writing accelerated for loops which take advantage of all available processors. Over time, more and more parallel features and optimizations will come on line to accelerate our code, as well as give you opportunities to further accelerate your code.

For those of you who need to make use of 64-bit address spaces, there is an Intel-based Mac 64-bit beta available, which you can obtain here:

http://www.mathworks.com/support/faq/macintel64.html

A note of caution regarding comparing the 64-bit beta's performance, or any pre-releases. While the 64-bit version will enable you to use significantly more RAM, the performance results for pre-release and beta versions of MATLAB are always going to be worse than released versions, because we deliberately leave in diagnostic code which impacts performance (notably, we ship with assertions enabled). Although the Intel-based Mac 64-bit beta was released with assertions disabled, the beta does not yet have the interpreter JIT enabled, which accelerates MATLAB command processing, and its absence will impact performance comparisons.

When it comes to setting our priorities for improving performance, we would like to hear from you specifically what is getting in the way of your work and what is most important to you. Assume that we run BENCH and are working on its differences in performance between platforms in future releases, and on graphics performance as well as numerics performance in general. We need to know more specifically what matters the most in the near-term. Let us know which version of MATLAB you are using, what specific features you are using, and exactly where you are observing performance issues with those features. We will use that information to help us set our near-term priorities. Remember if you are using an older version of MATLAB and haven't upgraded in a while, you may have some performance issues which we've already resolved in a more recent version of MATLAB.

Let me know if this helps.

Matlab and System Fonts

This is probably a small issue, but something that is needed many of a time for publication purposes. Apparently, Matlab's postscript language only recognizes a few fonts, although it allows to choose any of the system fonts in the plot window. When the plot or figure is exported to EPS or PDF, the fonts are typeset in the default Courier font.

I have tried to find a solution to this by looking into a way of adding fonts to Postscript library, but I haven't been successful. This is not an issue which is Mac-Specific. I had the same issues when I was on Windows.

On a similar issue, it would be nice if Matlab would allow the user to define a LaTeX or TeX preamble when using LaTeX or TeX interpreters. I am thinking of something like LaTeXIt preferences, which allows the user to define several preamble to be used when typesetting with different settings.

Matlab and System Fonts

Could you please elaborate? Which font do not work for you? I've just tried using a custom true-type font which I've added to OS X's font collection (OCR A Extended) in a matlab plot. I then exported it to EPS using -despc2 and the font works well in the EPS/PDF.

Matlab and System Fonts

Thanks for the reply. I am trying to match my figure fonts with my main text. I am using Minion Pro for the text (in LaTeX) and I have added the Minon Pro font family to the PDF category in the Font Book. When I change the fonts of the figure (the axes, labels, titles, etc.) to Minion Pro and export to EPS or PDF, the fonts show up as Courier.

Is there something that I am missing here? I would appreciate if you can give me a hint on how to resolve this issue. I am on Mac OS X 10.4.11 and Matlab R2008a.

Best,
Hooman

Re: Matlab and System Fonts

You might want to use the LaPrint to export the plot into the .eps and .tex files. The .tex file will contain the info of text on the figure. With \input{} in the figure environment, those texts on the figure will be consistent with your main context.

RE: MATLAB Performance Issues (my particular case)

First of all, thanks a lot to Brian Arnold for your detailed answer; I am extremely happy that there is an interest in making the performance of Matlab on the OS X equal to that on other operating systems.

At the moment for example some of the codes that I write consist mainly in repeated uses of the fsolve command. I will bench one or two examples of them for R2008b on OS X and on Windows using bootcamp (same computer) and report here. For the moment I wish to say that the performance difference in Matlab under OS X and Windows does not regard only graphics.

I copy/paste here something that I wrote on one of the Mathworks blog (http://blogs.mathworks.com/desktop/2009/01/05/happy-new-year-2/)

"For what regards the performance of Matlab on OS X, there is difference in all parts of the “bench” test except LU decomposition. I have also tried the bench command both on OS X and on Windows XP (same computer, same version of Matlab, XP running with bootcamp) and on OS X FFT is 1.7 times slower, ODE is 1.9 times slower, Sparse is 1.3 times slower, 2-D is 2.6 times slower and 3-D 1.4 times slower; LU is approximately equal. I have read of similar results from other people."

And I add here that the Matlab version the data refer to is R2008b.

In any case, I realize that the issues are very complicated; but at the same time I have become very curious, and I would like to know why, for example, to take an FFT in OS X takes 1.7 more time than in Windows while doing a LU decomposition is as fast as in Windows. Or in a way that looks more towards my practical interest, what changes will have to be done to the FFT in Matlab to make it as fast in OS X as it is in Windows.

I will post here the run time of a short program in both operating systems, I can provide the code if interesting/useful for the comparisons.

Example of running time of an actual program

I get back on what happens on running one of my programs. The performance I record is quite different from the one obtained with the "bench" command: in the case of my program Matlab on Windows (Bootcamp installation) takes between 3.0 and 3.3 seconds, while Matlab under OS X takes more than 18 (!) seconds - more than 5 times slower; measured with tic-toc.
There is no graphics in the program. It consists of a loop where for every repetition the zero of a function is found with fsolve. The function is calculated by multiplying some 2 by 2 matrices with complex elements; the matrices are calculated by a couple of function m-files (there are nested calls).

I would be really curious to know what causes such a large difference - as I said above, I can provide my code if it is helpful to find out where the slowdown comes from.

MATLAB 2009a?

Has anyone tried this version yet & noticed any changes?

The release notes state that Mac OS X 10.4 and lower will no longer get new software updates, but the compatibility chart states MATLAB is compatible with "10.5.5 and above". I assume this means that you need 10.5.5 to run 2009a & prior Leopard versions may get an update later?

.NET Frameworks apparently have tight integration with MATLAB now; I'd be pretty stoked if you could call Cocoa Framework methods from within MATLAB programs.

But I guess first things first; it needs to run with comparable speed (both computations and user interface) on Mac as with Windows.

EDITs
- currently downloading...
- activating product key is easy
- mouse scroll wheel seems fixed?
- got too antsy & loaded a 1x5M variable in the variable viewer & hung the program

Matlab 2009a

I have just installed it and for the things that directly affect me there is no significant change. But obviously it can be true that in this Matlab release Mathworks has worked mainly on other things that I cannot immediately notice because they do not affect directly the code that I run.

Apart this, I found a brief discussion of the situation in a blog and the first comment that appears blames the OS X operating system for this - the second comment is mine and I put the above statement in doubt.

2009a

Can't seem to edit my post after too long, but it seems I was wrong on the mouse scrolling... still unusably laggy.

Haven't had enough time (or need of MATLAB) to properly review everything that bugged me, but I'm not hopeful on any major improvements.

The link in the previous comment to the blog post has an interesting article. The 3rd commenter also seems like he did more than 10 seconds of research before posting his opinions, which is always nice & makes the article more relevant. However, the article put to bed my earlier fears of testing MATLAB running on VM in OSX vs. just OS X... unfortunately the #'s on the (quick and very specific) comparison showed faster in VM.

Cheers,
Ungenious

I am still very disappointed

I am still very disappointed that cmd-tab is broken in 2009a. I am actually very surprised that there isn't more buzz about the broken cmd-tab behavior around the web. When I search, I typically only find my own posts on the matter, generally followed by a few confirmations of the bug. I filed a bug report some time ago, but it's still marked as open. Do others mouse to the matlab window? I know that it's a very large impediment to my workflow. I have to cmd-tab, then click in the command window in order to gain focus on the matlab prompt. Prior to my upgrade to Leopard, this was not a problem.

It seems like a silly, simple complaint, but it actually costs me quite a bit of extra effort, and it's a psychological break from an otherwise smooth workflow.

Time to ditch X11

If Mathworks wants to improve Matlab, how about ditching X11, OSX has been out for what almost TEN YEARS, and they still don't have a native version?????

The Matlab workbench uses the QT toolkit which is a cross platform toolkit, it compiles against X11 on Linux, Carbon on Mac, and Win32 on Windows, why do they choose to compile it against X11 on the Mac???

In any case, I've pretty much stopped waiting for Mathworks to come out with usable version of Matlab for the Mac, and I've switched over to SciPy / PyDev / VTK.

Cmd-tab

CMD-tab here works as it does everywhere in OS X, it switches programs. If you want to switch windows, say editor to command-window, use cmd-`. This last command works in all OS X programs, including Matlab, at least, on my macbook.

That doesn't work

That doesn't work. That was the first thing I tried way back when. It hasn't worked on three separate macs. Sure, I can cmd-` once I focus the window. The problem is that NO windows of Matlab become focused when cmd-tabbing. On any other mac program, cmd-tabbing will bring the last active window into focus. Cmd-tabbing to matlab after the release of Leopard will bring up Matlab, but it will not focus any window. None at all without clicking. Cmd-` also will not work after cmd-tabbing unless you click to focus first. This is not the behavior of any other Mac program, nor the behavior of Matlab prior to Leopard. The bug has been confirmed by Mathworks (I even spoke with a representative by telephone who confirmed the behavior as a known bug.)

On 2009a, I have only had a

On 2009a, I have only had a problem with building some mex files, I had problems with linking to the mklblas and lapack that ship with matlab. I ended up just using apple's built in, instead.

The only other issue is that it is really slow, even compared to 2008b. Jobs that take 10 minutes now take closer to 20 minutes.

The fonts are sized properly though from the start!

In case there were any doubts left. . .

Center for Cognitive Neuroscience, UCLA
Dual 2.5ghz Xeon Octo-core, 8gb ram

Just chiming in with my experience as well. The matlab bench program on 2009a runs anywhere from 3 to 6x slower on osx than on other much less respectable machines running vista and on the same hardware. . . this is across the board poor performance.

I don't think as the technical adviser for our lab that I can recommend matlab on OSX for any serious work.

I really want to see an end

I really want to see an end to the need for X11 - as far as I'm concerned it's great to have X11 around to compile and run UNIX/Linux applications, but a product that's sold as being Mac OS X compatible needs to solely use the Mac OS X Cocoa display system.

Also, please ditch the menu bar on MATLAB and use the system menu bar. Many other cross-platform applications, like COMSOL Multiphysics have done a much better job on the UI.

70x slower...

Real world example:

I just ran through a series of neuromorphic modeling, Matlab 2009a, Core 2 duo 4G of Ram.
data set is pretty small (<11M)

with profile on
OSX 10.5.7: 5388 seconds

Ran it on a "LESS" capable windows machine with only 1G of ram in windows XP
740s

is there light at the end of the tunnel with Snow Leopard? Or should i just ditch and get back to windows?
Mac is superb for many things, but if i have to wait over hour for a simple simulation vs 10 mins... that's pretty ridiculous.

Matlab 2009a in Parallels

I installed Matlab 2009a in Parallels 4.0 build 3844.
My laptop has 4G of ram, and parallels is set to automatically manage memory for best performance.
The host op is Windows XP SP3.

I reran my modeling code as above:

In OSX - > 5000 seconds
In Parallels+WinXP - 755 seconds.

I have the luxury of running parallels and have a site license to run Matlab in Windows AND Mac, but i can see that some may not be in this position.

The downside is that the UI is not as fluid under parallels, then again, it was never that good with X11/java anyway.
(and the small

I wonder if it's just the type of operations i am running but for now parallels it is.

Simulink on Mac OS X

I haven't migrated to 10.5, but under 10.4 with Matlab 2008a, the performance of Simulink is really terrible. Sometimes mouse pointer sticks to a corner of the screen and there is no way of releasing it, unless X11 is terminated. Simple models cause the CPUs to work under a lot of stress. The UI is really ugly and overall very poor performance and appearance.

I am quite happy with switching to Mac, but Matlab and more specifically Simulink, makes me think twice. I really hope that Mathworks provides a native Mac version with similar performance to Windows and Linux machines.

2009a in Parallels Part 2

Since my little parallels experiment (see post above), i noticed that Parallels virtual machine was setup to use only 1 core of my Duo core CPU.

So i went in and changed the setting to 2 cores.
Lo and behold, when running Matlab again, it's speed dropped to the same as the MAC!

crazy.

I've since set my VM back to single Core and all is well (i.e., Matlab in Parralels kick ass.)

Outrageous performance

I would like to confirm slashj's 'experiment' with my own findings.

I run a MacBook Pro 2Gb, 2.4GHz Intel Core 2 Duo with Mac OS X 10.5.7 and Matlab R2008a.
Any computationally heavy Matlab program runs at least twice as slow on my Mac compared to significantly less performant PCs running Windows. Running Matlab for Windows under Parallels on my Mac not only increases computational performance, but also the UI interactivity is significantly improved.

I find the lack of a native Mac version really annoying as we pay as much for a Mac license as for a PC license, yet we obviously get substandard performance. I wouldn't be so upset about the loss in speed if this was also reflected in the license cost. Furthermore, I have completely abandoned Simulink on the Mac, as its UI is so bad to the point that it becomes unusable. Seriously, how do they even dare to include this? I'm sorry if I sound very critical, but as a paying customer you expect at least SOME quality for that amount of money. Either they make a decent Mac version or just abandon the Mac platform (because the Windows counterpart does do a great job).

Anyway, I really like the Mac (its UNIX underpinnings, etc) and it performs amazingly well with any other calculations I do in c/c++.

Just checked Mathworks job

Just checked Mathworks job openings and there is a couple of them specific for the development of matlab and simulink for the mac. If any one interested, follow the link below

http://www.mathworks.com/company/jobs/opportunities/Job-6901-Senior-Software-Engineer-Mac-OS-X-Development.html

btw: I´m not related to mathworks, but would love to work in the mac development of matlab.

I want to help troubleshoot this performance problem

slashj --

If I understand your investigations correctly, it sounds like multi-threading is going very wrong (even your "fast" Windows virtual machine slows down considerably when multi-threading is enable, yes?). In my naive experiments on an eight-core Mac running Leopard, multi-threading is helpful, or at least neutral.

Would it be possible for you to contact me so I can help troubleshoot this problem? My contact information is below.

Regards,
KEN ATWELL
Product Manager, Platforms and MATLAB Performance
The MathWorks
ken.NOSPAMatwell@mathworks.com
508 647 3114

Hi ken, thanks, just emailed

Hi ken,

thanks, just emailed you.

Any improvements in R2010a

Any improvements in R2010a ?

This is an old thread, but I just switched from PC to Mac, so I was wondering how much OS X Matlab has improved over the last year or so. I am running Matlab 2010a 64-bit on my PC laptop (2.66 GHz Core 2 Duo with 4 GB DDR3 RAM and a 7200 rpm HD) as well as on my brand new, top-of-the-line, astronomically expensive Macbook Pro (i7 2.66 GHz with 8 GB DDR3 RAM and a solid state drive).

The Macbook Pro in general is wonderful and runs everything like butter *except* for Matlab. The Matlab performance is almost identical on the Macbook Pro i7 and the PC Core 2 Duo. To be fair, they are both dual-core processors running at 2.66 GHz, but I would expect at least *some* performance boost from upgrading to a whole new generation of Intel processors (to say nothing of the memory and drive upgrades).

Given that Apple's market capitalization surpassed Microsoft's last week, this might be a worthwhile issue for Mathworks to tackle once and all...

To its credit, the Macbook Pro does multi-task better when I am running two simultaneous Matlab scripts while also web browsing or processing documents. This probably reflects the ability of the i7 to run two additional "virtual cores" during intense multi-tasking.

Can I do anything to achieve the same Matlab performance on my Macbook Pro that I would get from an i7-equipped PC?

I think things is getting

I think things is getting worse on i7 with 2010a. My test result is that 2010a runs slower on my MaBook Pro 15" 2.66 Core i7 than on Ubuntu 64-bit runs on the same machine through VMware 3.1, with only 2GB memory allocated for the virtual machine.

If you have Xcode installed,

If you have Xcode installed, locate and install the Processor PrefPane (located in Developer -> Extras -> PreferencePanes) and disable hyperthreading for the i7 processor. Hyperthreading causes the Intel math library to hammer the processor cache, resulting in significantly worse performance. Yes, this is ironic.

This is ridiculous! This is

This is ridiculous!

This is truly ridiculous how freaking bad Matlab suck on OSX.

I use R2010a (less and less each week) on both Linux and OSX.

OSX has what, 10000X times the market share of desktop LInux, and they still put out something that has the fit and finish of as CS141 (intro to X11 programming) class project!!!!

I am painfully aware that some of the GUI is Java/AWT. WTF can't Mathworks use the Eclipse framework!!!

Eclipse is the one decent Java app out there. I use Photran and PyDev, and it work, and dammed nicely.

Come On, why doesn't the Windows version use X11?

The workbench is so freaking bad on OSX that I use Emacs as my Matlab environment.

Now, from what I can tell, its essentially the same Java workbench on Linux and OSX, why is the Linux workbench usable? On Linux, it looks like some sort of Java swing sort of toolkit, which is tolerable, but why do they have to create this really really bad copy of the Cocoa widgets on OSX, if its going to be an alien app (no system menu bar), why not just use the same toolkit on Linux, sure it looks a bit out of place, but no where near as out of place as the horid emulation of Cocoa that it currently uses.

Yes, I know I'm ranting. But I have been waiting almost TEN FREAKING YEARS for a usable Matlab on OSX, and I've pretty much given up.

I'd be really interested in

I'd be really interested in seeing some benchmarks that demonstrate how slow it is. I'll admit that I haven't worked on a Windows machine much with Matlab, but on my PB G4 1.67GHz Matlab runs quite well and the graphics are reasonably snappy.

You can try Matlab's internal bench.m function (run it with an input argument so that it repeats many times). Share this hear and maybe we can makes some comparisons. There are also framerate programs on the Mathworks file exchange and they might be useful for characterizing graphical speed. I too am about to pop ~$4k on a Mac Pro, but want a sense for the speed I can expect, otherwise I might go Linux (It'll be a dark day when I use a Windows machine!).

Let's try to figure out if it is a problem with your machine and installation, the beta version, or something else.

Brain Arnold, Thanks for the

Brain Arnold,

Thanks for the hint. May I ask is it, Hyperthreading, only affect MatLab or anything using intel math library? What is Intel Math Library? Does it come with OS X or MatLab? Or by the name you mean MKL?

A curious example of a

A curious example of a script that runs quickly on Windows but slowly on OS X is the following; it just draws a couple of very simple functions, a couple of times to show clearly when the performance is slow; the part that slows is down is fixing a figure's position.

x = 1:50;
y = 1:50;

[X,Y]=meshgrid(x,y);

linear_map = zeros(3,50,50);

for m = 1:3
linear_map(m,:,:) = m*X+Y;
end

screen_size_all_monitors = get(0, 'MonitorPosition');
screen_size = screen_size_all_monitors(1,:);

% Fixing the figure position
for m = 1:3
figure(1)
colormap jet
clf
set(gcf,'NumberTitle', 'on', 'Name',['Graph number ' num2str(m)], ...
'Position', [0 0 screen_size(3) screen_size(4)],...
'renderer', 'zbuffer');

pcolor(X, Y, squeeze(linear_map(m,:,:)))
pause(.5)
end

% Without fixing the figure position
for m = 1:3
figure(1)
colormap jet
clf
set(gcf,'NumberTitle', 'on', 'Name',['Graph number ' num2str(m)], ...
'renderer', 'zbuffer');
pcolor(X, Y, squeeze(linear_map(m,:,:)))
pause(.5)
end

% Fixing the figure position
for m = 1:3

figure(2)

set(gcf, 'Name', ['Graph number' num2str(m)], ...
'Position', [0 0 screen_size(3) screen_size(4)]);

subplot(3,1,1)
plot(x, m*x)
title('Subplot 1')
subplot(3,1,2)
plot(x, x.^m)
title('Subplot 2')
subplot(3,1,3)
plot(x, x.^(1/m))
title('Subplot 3')

pause(.5)

end

% Without fixing the figure position
for m = 1:3

figure(2)

set(gcf, 'Name', ['Graph number' num2str(m)])
subplot(3,1,1)
plot(x, m*x)
title('Subplot 1')
subplot(3,1,2)
plot(x, x.^m)
title('Subplot 2')
subplot(3,1,3)
plot(x, x.^(1/m))
title('Subplot 3')

pause(.5)

end

Slow because of

Slow because of X-Windows

Perhaps the most fundamental problem with MATLAB on OSX is the use of X-Windows. This is the native windowing system on Linux, but it NOT NATIVE on OSX. On Windows, MATLAB uses the native Microsoft Windows APIs for drawing, but on OSX, it uses X-Windows which is an alien application.

MATLAB is find on Windows because it uses the native libraries, MATLAB is fine on Linux because it uses the native libraries, but it uses the huge translation layer on OSX to draw anything. We could at least get MATLAB for say 10% of what a Windows or Linux license costs because Mathworks seems to spend about 0.000001% of their time trying to make the OSX version usable.

I am not anymore sure. I

I am not anymore sure. I have tried the above program with R2010b, which does not use X11, and I got the same strong slowdown for placing the figure in a given place (the command to place the figure takes about 1 second to execute on a Core2 duo 2.5 GHz).

Thanks for flagging this. I

Thanks for flagging this. I just started looking at this, but on my Mac, things run much faster if I reduce the vertical screen usage by about 170 pixels. That is, add a line like this to code before you do any plotting:

screen_size(4) = screen_size(4) - 170;

I'm guessing that the real estate "reserved" for the Dock or screen menu is coming into play here in some way, but I'll need to dig deeper and/or consult with others before knowing for sure.

KEN ATWELL
Product Manager, Platforms and MATLAB Performance
The MathWorks
ken.NOSPAMatwell@mathworks.com
508 647 3114

Hello, Two years ago, the

Hello,

Two years ago, the Mac version of Matlab/Simulink was slower than the PC version. How about 2010a? I am using a new Macbook Pro (i7, 8GB RAM). On the same laptop, which of the following produces the best performance for computationally intensive numerical simulation tasks that require lots of RAM? I use Matlab, Simulink, Real-Time Workshop, Real-Time Workshop Embedd Coder, SimPowerSystems, SimMechanics, Stateflow, etc.

One interesting thing I found is that under activity monitor in Snow Leopard, the two real cores are running actively while the two virtual cores do not seem to be used a lot. However, when I booted to Vista via Bootcamp, there are almost the same amount of activity in all four cores (2 real and 2 virtual).

a) Snow Leopard 10.6.4 (default booted to 32-bit kernel)
b) Snow Leopard 10.6.4 (under 64-bit kernel)
c) Vista 64-bit

Thank you.

what exactly do you mean by

what exactly do you mean by 'virtual cores'. The i7 processor has 4 physical ALU (arithmetic logic units) that are shared between 8 execution units (pretty sure the i7 has 8 register files, but 4 of most everything else), so in effect, it appears as an 8 core processor. Depending on how IO bound your code is, it is sometimes better to disable hyper-threading (can be done with installing xcode, and using the processor prefs pane).

IMO, your probably better of using Linux for MATLAB, as the Mac version is an unmitigated disaster (not sure what MathWorks is doing with all their revenue they get from $2000 a seat, but it sure as hell is not going into improving Mac version though). Don't know about windows, as the last time I was forced to touch windows was about 10 years ago. My MacPro is set up for a dual boot between OSX and Linux (Ubuntu), so I boot into Linux for the MATLAB stuff I still do.

I've pretty much given up on MATLAB ever improving on the Mac, so I've essentially switched over to Python/Fortran, at least I have a decent IDE to work with for these languages with Eclipse.

Hi Ken, I just installed

Hi Ken,

I just installed 2010a on my Macbook, and like these other guys I'm feeling a bit of buyer's remorse right now. We have licenses at school and my workplace, but I thought it would be nice to be able to run the IDE on my Macbook when I'm working remotely. Turns out it's truly unusable: scrolling from one page of code to the next in a 150-line script sometimes takes up to 1 second, and is never fast enough to not be jarring.

Tried your screen-size trick but not noticeably better. Can you suggest any other tricks?

Thanks,

Mike H

This is an interesting

This is an interesting thread for me having just upgraded from Parallels 5 to Parallels 6 in order to squeeze more performance out of a Windows version of Matlab on my (new) MacBook Pro, and things got worse as documented by bench, especially 3D graphics. (P6 is supposed to be better than P5 for 3D graphics.) So, I am now running an OS X version of Matlab. I'll offer some bench numbers, versions and machine details, but along the way I discovered something that has not heretofore been mentioned in this thread.

That is that my MacBook Pro (2.66GHz Intel i7 with 8GB RAM) has an NVIDIA GeForce GT330M video card, but also Intel HD Graphics on board the chipset. This can be seen via the upper-left Apple logo => About This Mac => Info => Graphics/Displays. Well, most of the time the display is connected to the Intel HD Graphics to save battery power (I've read on the net), but even when the laptop is on AC (in my case). The Mac switches to the video card when performance demands it with certain applications. In "Graphics/Displays" one can see which of the two GPUs is driving the monitor. Well, in my experience running Matlab's bench, the Mac never switches to the NVIDIA video card! It runs bench with Intel HD Graphics. No wonder the 3D graphics bench stinks. I don't know what to do about that. Does Apple have a list of favored applications capable on invoking the video card and Matlab is not on that list? Don't know. Anyone else?

The Mac has been described, but I need to note that the Parallels 5 and 6 results are with 4GB RAM, not the 4GB and 8GB of the OS X results. My Windows 7 machine is an HP Elite Intel i7 at 2.80GHz with 8GB and an ATI Radeon HD 5770. I run 2010a and 2010b on Win7, 2010a on Parallels 5 and 6 on the Mac, and 2010b on OS X. The bench results are best of three. The first two and last two results help reconcile the rest, ceteris paribus.

Win7/2010a/8GB: 0.0559, 0.0445, 0.1643, 0.2236, 0.3458, 0.1682 (total=1.0023)
Win7/2010b/8GB: 0.1062, 0.1474, 0.1258, 0.2182, 0.2229, 0.1134 (total=0.9339)
Par5/2010a/4GB: 0.0911, 0.1176, 0.1808, 0.2348, 0.5271, 0.8058 (total=1.9572)
Par6/2010a/4GB: 0.0832, 0.1186, 0.1667, 0.2293, 0.4872, 2.2461 (total=3.3311)
OSX/2010b/4GB: 0.0641, 0.1026, 0.1516, 0.2905, 0.5559, 0.7636 (total=1.9283)
OSX/2010b/8GB: 0.0620, 0.0925, 0.1527, 0.2791, 0.5001, 0.7563 (total=1.8427)

Hi Mike, Sounds like you've

Hi Mike,

Sounds like you've got a java issue. See this link on the Mathworks help site: http://www.mathworks.com/support/bugreports/412219

This has always fixed the slow scrolling issue for me.

Cheers,
Michelle Gill

I have been reading the

I have been reading the entries in this thread with a lot of concern.
I am a student working on a mathematical model describing the transmission of an infection in a population. I have set up a stochastic model which is quite computationally expensive when I run it on a Toshiba (2.20GHz, 4MB L2, 800MHz FSB) running on Windows - takes about 6 hours - though I am sure I can do some optimization using the profiler in Matlab.
I am at a point in my research where I want to buy a new machine. I have been considering a move to Mac OS and getting a Matlab license for the same platform. From this thread, it seems like this is not a good idea. The other option would probably be to run Matlab on Linux. Comparing the three platforms i.e Windows, Linux-Ubuntu and MacOS, on which platform does Matlab work optimally?

regards,
timo