Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Performance Issue on Mac

Subject: Performance Issue on Mac

From: TreeMan

Date: 22 Dec, 2010 08:21:05

Message: 1 of 12


I have a reasonably new MacBook Pro that runs Matlab painfully slow. The benchmark results are not too bad but the responsiveness of the GUI interface is incredibly slow. Getting a prompt in the command window takes several seconds! It is almost unusable. I finally installed the windows version on a Windows 7 virtual machine on the same mac and the responsiveness is much better.

I see some reference to similar problems but mostly with older versions of Matlab and Mac OS.

Here are the hardware specifics:
Model Name: MacBook Pro
  Model Identifier: MacBookPro6,2
  Processor Name: Intel Core i7
  Processor Speed: 2.66 GHz
  Memory: 8 GB
  Processor Interconnect Speed: 4.8 GT/s

MAC OX 10.6.5
Matlab Version r2010b

The benchmark results on the MAC running native:
0.0653 0.3137 0.1880 0.2929 0.5501 1.0050

On the Win 7 VM:
0.0708 0.1145 0.1343 0.2903 0.5104 0.3800

But the real pain is in the responsiveness of the interface.

Any ideas on how to make Matlab on MAC more zippy?

Thanks!

Subject: Performance Issue on Mac

From: Wlodek Tych

Date: 28 Jan, 2011 10:54:03

Message: 2 of 12

Hi Treeman,

I must say I have been having similar thoughts. My benchmark results are below.

What I find hard to comprehend is how can _any_ of emulator results be any faster than the native code, especially the numerical parts. This is very worrying indeed.

And then the graphics results are hugely (2-3 times) slower on the native (?) Mac than on the Windows emulator. How can this be? Could by any chance the Mathworks Mac graphics team talk to the Windows graphics Mathworks team? And possibly the graphics team at Parallels too, although this might involve more than a visit in another office across the corridor.

While I am on the graphics topic - there seem to be a reproducible problem with 3D plots I have noticed on the Mac as I was working on a paper recently. I had to do some of the plots on the PC, as the Mac was showing empty axes.

In general I am not happy with the Mac Matlab version, so even though I much prefer to work on a Mac than on a PC, I still tend to go back to Windows for some of the tasks.

This is in spite of quite a high price we are paying for Matlab.

I am seriously hoping that with more user interest this thread will eventually attract attention of the Mathworks. I find it quite frustrating that your post was left unanswered for all this time.

Best wishes,

Wlodek
(Matlab Technical Contact at Lancaster University, Matlab user since 1985, teaching Matlab and Matlab-based courses for some 15 years)

Computer specification:
Mac Pro OS X 10.6, 2.66 6-core Intel Xeon, 8GB RAM

Test 1:
Running Matlab 2010b (Mac Intel 64 bit):
    0.0509 0.1057 0.1597 0.3905 0.7481 0.7430

Test 2:
Running Matlab 2010b (VM 64bit Windows 7 running on Parallels):
    0.0798 0.0964 0.1330 0.1992 0.3507 0.2227

Subject: Performance Issue on Mac

From: Steven_Lord

Date: 31 Jan, 2011 02:36:53

Message: 3 of 12



"Wlodek Tych" <w.tych@lancaster.takethisout.ac.uk> wrote in message
news:ihu78b$5i1$1@fred.mathworks.com...
> Hi Treeman,
>
> I must say I have been having similar thoughts. My benchmark results are
> below.
>
> What I find hard to comprehend is how can _any_ of emulator results be
> any faster than the native code, especially the numerical parts. This is
> very worrying indeed.
> And then the graphics results are hugely (2-3 times) slower on the native
> (?) Mac than on the Windows emulator. How can this be? Could by any chance
> the Mathworks Mac graphics team talk to the Windows graphics Mathworks
> team? And possibly the graphics team at Parallels too, although this
> might involve more than a visit in another office across the corridor.
> While I am on the graphics topic - there seem to be a reproducible problem
> with 3D plots I have noticed on the Mac as I was working on a paper
> recently. I had to do some of the plots on the PC, as the Mac was showing
> empty axes.
> In general I am not happy with the Mac Matlab version, so even though I
> much prefer to work on a Mac than on a PC, I still tend to go back to
> Windows for some of the tasks.
>
> This is in spite of quite a high price we are paying for Matlab.
> I am seriously hoping that with more user interest this thread will
> eventually attract attention of the Mathworks. I find it quite frustrating
> that your post was left unanswered for all this time.

Please contact Technical Support for assistance in determining the cause of
these performance results and to bring your other comments to the attention
of the development staff.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Performance Issue on Mac

From: Wlodek Tych

Date: 31 Jan, 2011 11:58:04

Message: 4 of 12

> Please contact Technical Support for assistance in determining the cause of
> these performance results and to bring your other comments to the attention
> of the development staff.
>
> --
> Steve Lord

Dear Steve,

Thank you for your kind reply.

Please consider my post as informing you of an issue. I shall now contact you directly by e-mail to offer my help to identify the problems.

Best wishes,
Wlodek

Subject: Performance Issue on Mac

From: Steven_Lord

Date: 31 Jan, 2011 18:26:43

Message: 5 of 12



"Wlodek Tych" <w.tych@lancaster.takethisout.ac.uk> wrote in message
news:ii684c$skh$1@fred.mathworks.com...
>> Please contact Technical Support for assistance in determining the cause
>> of these performance results and to bring your other comments to the
>> attention of the development staff.
>>
>> --
>> Steve Lord
>
> Dear Steve,
>
> Thank you for your kind reply.
>
> Please consider my post as informing you of an issue. I shall now contact
> you directly by e-mail to offer my help to identify the problems.

I've done a bit of investigating and I suspect the numerical performance
issue may be related to bug report 535814.

http://www.mathworks.com/support/bugreports/535814

To determine if it is, compare the performance of BENCH with different
maxNumCompThreads levels, from 1 up to 6 (the number of cores your original
message indicated your machine has.) If reducing the number of
computational threads improves the performance, you can add that command to
your startup.m file and watch this bug report (by clicking on the check mark
in the Watch column) which should inform you whenever this bug report is
modified.

I don't believe this would impact the performance of the graphics, but I
haven't personally done much Mac graphics performance investigation work
recently. The only known issues that I could find that could be related to
the empty axes behavior you described involve very narrow Z limits on a
plot.

http://www.mathworks.com/support/bugreports/325044

I recommend that you contact our support staff for help with the graphics
performance issue and for help with the empty axes issue (if the above bug
report does not resolve the problem.) The Mac and graphics specialists in
support may know of an issue of which I am unaware, and even if not they
will know of better troubleshooting techniques applicable for Mac graphics.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Performance Issue on Mac

From: Malcolm Lidierth

Date: 5 Feb, 2011 18:57:03

Message: 6 of 12

This does look like a general issue. Here are my bench results showing XP under bootcamp to be up to 2x faster on the same Mac. Changing maxNumCompThreads does not help.

Spec: 2.26. GHz Intel Core Duo, 4GB 1067 MHz DDR3
-------------------
64 bit MATLAB (Mac)
>> bench
ans =
    0.1221 0.1482 0.2165 0.3396 0.8992 1.1920
>> maxNumCompThreads(2)
Warning: maxNumCompThreads will be removed in a future release. Please remove any instances of this function from your
code.
> In maxNumCompThreads at 27
ans =
     1
>> bench
ans =
    0.1711 0.1703 0.2190 0.3583 0.9322 1.1656
---------------------
compare with a 32 bit on Windows XP under BootCamp
>> bench
ans =
    0.0940 0.1187 0.1419 0.2682 0.4137 0.7151
>> maxNumCompThreads(1)
Warning: maxNumCompThreads will be removed in a future release. Please remove any
instances of this function from your code.
> In maxNumCompThreads at 27
ans =
     2
>> bench
ans =
    0.1242 0.1115 0.1437 0.2908 0.3949 0.7250
------------------------------------------------
For completeness:
Use 32 bit on the Mac instead of 64
>> bench
ans =
    0.0948 0.1726 0.2150 0.3506 1.0669 1.2324

Subject: Performance Issue on Mac

From: Wlodek Tych

Date: 7 Feb, 2011 15:27:03

Message: 7 of 12

"Malcolm Lidierth" wrote in message <iik6hv$n9r$1@fred.mathworks.com>...
> This does look like a general issue. Here are my bench results showing XP under bootcamp to be up to 2x faster on the same Mac. Changing maxNumCompThreads does not help.

Thanks Malcolm. I am rather pleased (in a way) that I am not the only one experiencing these oddities and willing to share them.

For Steve, the results for varying threads parameter are below. Apart from LU times, all the Mac times are slower, there seems to be no change for sparse computations when changing the number of threads, and graphics results are far worse, which I really find suprising, but I worry less about that, as numerical computations are the main issue for me.

I find that the benchmark results can change quite substantially from day to day, to give some uncertainty credit to TMW. I always aim at obtaining them on a freshly rebooted Mac with a minimal number of applications running, I also run bench command 3-4 times and pick the last one after consistency has been reached following each change of settings. I don't reboot between the trials for different thread parameter, this would have taken too much time.

Mac (automatic max threads = 24)
   0.0543 0.1506 0.1675 0.2973 0.5739 1.2549

Mac max threads: 12
    0.0375 0.1175 0.1713 0.2371 0.5754 1.1219
Mac max threads: 6
    0.0398 0.1200 0.1671 0.2146 0.6977 0.7635
Mac max threads: 3
    0.0400 0.1207 0.1703 0.2101 0.5154 0.7410
Mac max threads: 2
    0.0488 0.1257 0.1689 0.2176 0.5402 0.7287
Mac max threads: 1
    0.0773 0.1195 0.1691 0.2092 0.5291 0.7495

Mac back to automatic (as a consistency check):
    0.0442 0.1212 0.1684 0.3645 0.5694 0.7304


Windows 7 (Parallels):
    0.0818 0.1061 0.1356 0.2118 0.3810 0.2722

3D graphics is up to 4-5 times slower in the native Mac application. Numerical computations are 10-50% slower, except for LU benchmark, which is faster on the Mac.

As I said, I cannot understand these differences between native and VM/emulator run codes, Parallels results should all be slower.

Best wishes,
W.

Subject: Performance Issue on Mac

From: Ian

Date: 19 May, 2011 15:29:04

Message: 8 of 12

"Wlodek Tych" wrote in message <ihu78b$5i1$1@fred.mathworks.com>...
> What I find hard to comprehend is how can _any_ of emulator results be any faster than the native code, especially the numerical parts. This is very worrying indeed.

Never trust values from virtualised environments. I'm not sure of the specifics, but many benchmarks run faster in a VM than outside of it. I remember testing lots of browser benchmarks and finding Windows was giving significantly faster numbers in a VM than running natively on the same hardware, this is not specific to Matlab.

Has anyone tried their benchmarks with Bootcamp and 2011a? Also, are there better benchmarks for matlab than bench?

As far as the original poster - is the problem related to speed of GUIDE GUIs or the rest of the Matlab UI?

Subject: Performance Issue on Mac

From: Wlodek Tych

Date: 19 May, 2011 16:09:04

Message: 9 of 12

"Ian" wrote in message <ir3d00$cip$1@newscl01ah.mathworks.com>...

> Never trust values from virtualised environments. I'm not sure of the specifics, but many benchmarks run faster in a VM than outside of it. I remember testing lots of browser benchmarks and finding Windows was giving significantly faster numbers in a VM than running natively on the same hardware, this is not specific to Matlab.

Now you got me! I cannot see how an emulator based computation can be faster than a native one, but there must be a reason of course. Do you know of any explanation for this? Timers not working correctly in emulation?

As for your other question, bench.m is a pretty good all-round benchmark, trying a mix all the traditional types of computations. I suspect we all have our own specialised ones, but with narrower comparison base.

Thanks for your answer,
W.

Subject: Performance Issue on Mac

From: Malcolm Lidierth

Date: 19 May, 2011 16:56:20

Message: 10 of 12

Bootcamp and R2011a

Mac (64 bit)
0.2391 0.4893 0.2680 0.3220 0.9273 1.2634

Windows XP (32 bit)
0.5768 0.4325 0.1491 0.2741 0.3958 0.8035

Subject: Performance Issue on Mac

From: Wlodek Tych

Date: 20 May, 2011 09:14:05

Message: 11 of 12

"Malcolm Lidierth" wrote in message <ir3i3k$rnv$1@newscl01ah.mathworks.com>...
> Bootcamp and R2011a
>
> Mac (64 bit)
> 0.2391 0.4893 0.2680 0.3220 0.9273 1.2634
>
> Windows XP (32 bit)
> 0.5768 0.4325 0.1491 0.2741 0.3958 0.8035

Could you clarify, please? Is this an experiment complementary to mine? Same Mac, one set of results from Mac Matlab, one from Windows Matlab running on Bootcamp/XP?

If so, the results from virtual PC running on the Mac should be better (faster). I am still unclear how this could happen, but if true it would be a good arument for everybody to use virtual machines instead of naively running native code directly hoping it would run faster than in an emulator.

Could someone explain this apparent paradox, please?

Best wishes,
W.

Subject: Performance Issue on Mac

From: Malcolm Lidierth

Date: 20 May, 2011 10:42:04

Message: 12 of 12

No VM here, Bootcamp provides dual boot to XP, so no chance of messing up the timer.
Does all this suggests the libraries/builtins MATLAB is calling are better optimised for Windows than an Intel Mac?
Besides some of the benchmarks, code performance is noticeably more sluggish when running my own graphically-intensive code on the Mac.
Elsewhere on this newsgroup, someone suggested this was specific to the model of Mac - the data above were from a 2.26 GHz Core 2 Duo , 4Gb MacBook Pro with a GeForce 9400M.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us