Results 1 to 3 of 3

Thread: C++ performance in Ubuntu vs. Mac OS X

  1. #1
    Frisco Gilberto is offline Junior Member
    Join Date
    Aug 2009
    Posts
    26
    Rep Power
    0

    Default C++ performance in Ubuntu vs. Mac OS X

    I have a puzzle. I have an HP desktop running Ubuntu 9.04 and a Mac Book Pro running Mac OS 10.5. I am running a piece of C++ code, which reads 100,000 lines of binary data and writes it out to another file in ASCII. It runs nearly 6 times faster on my MBP than on the HP (2 secs vs. 12 secs). But, the HP is a bigger/faster machine. Here are the specifics:

    Ubuntu 9.04 with 4GBs ram, Intel 2.4GHz Quad 2 Core Q6600, Seagate 7200 rpm 750GB hdd, filesystem is ext3, GCC version is 4.3.3.

    MBP with 1GB ram, Intel 2GHz Core Duo, 5400 rpm hdd, GCC version is 4.0.1.

    I have compared the output with diff and cmp and they are the same. Anyone have any ideas why this is happening? Shouldn't the HP Ubuntu machine be running this faster? I would really appreciate your help!

  2. #2
    Join Date
    Aug 2009
    Posts
    51
    Rep Power
    3

    Default

    Apple keep very tight control over the hardware used (and supported) in their products, so the OS and related tools can be very highly optimized for the hardware; Ubuntu running on generic PC hardware would require multiple abstraction layers to allow for the huge range of possible hardware devices.

    The result is Apples are faster, but you pay for it by having a restricted choice of more expensive hardware.

  3. #3
    Osana Pancha is offline Member
    Join Date
    Aug 2009
    Posts
    38
    Rep Power
    0

    Default

    If you are already familiar with Linux a bit, you could compile your own kernel to be a bit more tailored to the hardware on your system. Compiling the C runtime libraries on your system with some optimizations turned on would probably help too. However, this would probably only get you a few percent extra performances. As MrLinux pointed out, it is much easier to optimize for performance when you are only targeting a very narrow possible list of hardware configurations.

    Also, just for the sake of better experimental rigor, it is probably best if you were to perform the test using Ubuntu dual booted on the same hardware. Either make your HP machine into a hackintosh or put ubuntu on the other machine. Also, try to get the same version of GCC if possible (there could be performance regressions that you don't know about). I'd say it is better to do it this way, so that you can have a better understanding what difference the OS and available runtime libraries make. In any experiment, it is best to keep the number of changing variables to a minimum.

Similar Threads

  1. How to get better Mac's performance
    By MoralesWard in forum Operating System
    Replies: 2
    Last Post: 06-26-2010, 12:36 PM
  2. Upgrading Ubuntu 8.10 to Ubuntu 9.04 Desktop Edition
    By Steve Harlow in forum Linux/Free BSD
    Replies: 1
    Last Post: 12-08-2009, 11:37 AM
  3. Software and performance
    By arsenal in forum Software Jargons
    Replies: 0
    Last Post: 11-12-2009, 03:17 PM
  4. CPU Performance
    By jack879 in forum CPU & Components
    Replies: 0
    Last Post: 03-24-2009, 06:18 AM
  5. Printers Performance
    By allster in forum Printer
    Replies: 0
    Last Post: 02-20-2009, 11:07 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48