Why is Java so slow on Mac OS X?

Posted:
in macOS edited January 2014
... when compared to other platforms (i.e. Windows, Unix, etc.)?
«13

Comments

  • Reply 1 of 50
    I think the short answer is that it isn't, but I'd be able to offer more information if you were a bit more specific in your complaints.
  • Reply 2 of 50
    staphbabystaphbaby Posts: 353member
    I also have not noticed this. Are you talking about GUI slowness, or just code execution?
  • Reply 3 of 50
    pbpb Posts: 4,255member
    Java is indeed very slow on OS X compared to how it runs on other platforms. See for example the discussion in this macnn thread, around the middle of the page, some post by Dr.Michael. It posts the execution time of a program he wrote in java, in a Powerbook and a Centrino laptop.



    Quote:



    My score:

    On my Powerbook (12 inch, 1GHz, 768 RAM)

    OS 10.3: 310 ms

    Yellow Dog Linux 3.01: 485 ms

    Windows NT4 in VirtualPC 6.1: 540 ms

    .

    .

    .

    OK, here are the PC scores:

    IBM Thinkpad T40 (1.6 GHz Pentium M, 1 GB RAM)

    Suse Linux 9.0: 112 ms

    Windows XP: 105 ms









    Note that the Pentium M processor is 60% faster than the G4 in the Powerbook, but his program runs 3 times faster under XP than under OS X! It is evident that there exist somewhere a serious bottleneck in OS X's implementation of Java. Apple needs to correct this.
  • Reply 4 of 50
    the generalthe general Posts: 649member
    Quote:

    Originally posted by PB

    Java is indeed very slow on OS X compared to how it runs on other platforms. See for example the discussion in this macnn thread, around the middle of the page, some post by Dr.Michael. It posts the execution time of a program he wrote in java, in a Powerbook and a Centrino laptop.







    Note that the Pentium M processor is 60% faster than the G4 in the Powerbook, but his program runs 3 times faster under XP than under OS X! It is evident that there exist somewhere a serious bottleneck in OS X's implementation of Java. Apple needs to correct this. [/B]



    umm, I would probably point to soemthing else.. WHY? well, lets see, OSX was faster than Yellow Dog linux, and linux on pc was faster than linux on G4.. doesnt look like an OSX issue to me..
  • Reply 5 of 50
    kim kap solkim kap sol Posts: 2,987member
    It may be slower on OS X but who really cares? People still use Java?



    Java never became as cross-platform as it was supposed to be thanks to various reasons and thanks to Microsoft. It was never a very good development language either, maybe slightly better than C++ but nothing ground-breaking.



    So the question is, why isn't Java dead?
  • Reply 6 of 50
    pbpb Posts: 4,255member
    Quote:

    Originally posted by kim kap sol





    So the question is, why isn't Java dead?








    Good question.
  • Reply 7 of 50
    pbpb Posts: 4,255member
    Quote:

    Originally posted by The General

    umm, I would probably point to soemthing else.. WHY? well, lets see, OSX was faster than Yellow Dog linux, and linux on pc was faster than linux on G4.. doesnt look like an OSX issue to me..



    For me, the message is that Java is another example of poorly written software for the PowerPC, something not surprising. On the G4, OS X and YDL have a big gap between them, in favor of OS X, but on Pentium M the difference is very small. So, OS X is already in a better shape with respect to YDL (the contrary would be unacceptable), but I don't know if there are optimization difficulties inherent to the pairing PPC architecture-Java. I would be really surprised if this is the case.
  • Reply 8 of 50
    boemaneboemane Posts: 311member
    Quote:

    Originally posted by kim kap sol

    It may be slower on OS X but who really cares? People still use Java?



    Java never became as cross-platform as it was supposed to be thanks to various reasons and thanks to Microsoft. It was never a very good development language either, maybe slightly better than C++ but nothing ground-breaking.



    So the question is, why isn't Java dead?




    Java is a great development platform! Java has a really clean and nice structure, and everything (mostly) is consistent! I could hardly say the same thing for other language, including c++.



    Im not sure why Java would be slower on a Mac, but it might be the way the application is written. If it has a lot of memory allocation (test programs are often of the type "create an insanely huge array and populate it with data", that might be the problem in the first place. Remember, the Pentium M has a lot of L2 cache!



    .:BoeManE:.
  • Reply 9 of 50
    smalmsmalm Posts: 677member
    For me, this shows the underwhelming performance of a G4 system implementation. A Pentium M system trounces a G4 sytem even at the same speed.

    This comparison tells us nothing about the java implementation.
  • Reply 10 of 50
    kim kap solkim kap sol Posts: 2,987member
    Quote:

    Originally posted by BoeManE

    Java is a great development platform! Java has a really clean and nice structure, and everything (mostly) is consistent! I could hardly say the same thing for other language, including c++.



    Im not sure why Java would be slower on a Mac, but it might be the way the application is written. If it has a lot of memory allocation (test programs are often of the type "create an insanely huge array and populate it with data", that might be the problem in the first place. Remember, the Pentium M has a lot of L2 cache!



    .:BoeManE:.




    If it's such a great dev platform why hasn't everyone switched to Java? And why are Java apps so shitty?
  • Reply 11 of 50
    buonrottobuonrotto Posts: 6,368member
    Well, I hate it when I go to a web page on my work PC and some Java ad or somesuch decides to load. Five minutes later, it finishes loading and I can click on stuff again. It' never been nearly fast enough on anything I've used.
  • Reply 12 of 50
    Quote:

    Originally posted by kim kap sol

    If it's such a great dev platform why hasn't everyone switched to Java? And why are Java apps so shitty?



    A huge proportion of server side code is written in Java; a very large number of web sites, intranet sites etc. Its more suited to business applications and the server side than consumer products.



    In terms of cross platform client apps, its great for having a single application that will run the same on any platform, but not great for writing proper, native, fit in totally to the system apps.



    Also you wouldn't notice a Java-Cocoa app running under OS X anyway.
  • Reply 13 of 50
    chris cuillachris cuilla Posts: 4,825member
    Quote:

    Originally posted by kim kap sol

    People still use Java?



    Yes. Many. Mostly in enterprise applications, and it serves it purpose fine there.



    Quote:

    Java never became as cross-platform as it was supposed to be thanks to various reasons and thanks to Microsoft.



    Not entirely true. Java is developed cross-platform quite a bit (Linux, Solaris, AIX, Windows, Mac OS X) and quite well actually.



    Quote:

    It was never a very good development language either, maybe slightly better than C++ but nothing ground-breaking.



    Not a great development language but also not terrible. Ground-breaking? No...but no one cares. Ground-breaking is so rare and when it happens only a small percentage of people realize or care. Objective-C, for example, is a great language (especially compared to Java). But no one cares much. Too bad too. Compared to C++? C++ is mind-numbingly complex. It is a horrible language.



    Quote:

    So the question is, why isn't Java dead?



    Momentum.
  • Reply 14 of 50
    zapchudzapchud Posts: 844member
    Quote:

    Originally posted by smalM

    For me, this shows the underwhelming performance of a G4 system implementation. A Pentium M system trounces a G4 sytem even at the same speed.

    This comparison tells us nothing about the java implementation.




    Keep in mind that running the program is only 42% slower when run in VirtualPC, on NT. Considering the usual overhead in emulation, this implies that the Java implementation on OS X is indeed slow as ****! :-)
  • Reply 15 of 50
    boemaneboemane Posts: 311member
    Quote:

    Originally posted by kim kap sol

    If it's such a great dev platform why hasn't everyone switched to Java? And why are Java apps so shitty?



    Well. The answer to that question is easy. If Mac OS X is so great, why havent everyone switched to it ? Keep in mind that about 30% of all code that is written is written in Java!



    I have had several Java units at my university, and I have had units that teach other languages like C, C++, Assembly, etc. And I have to say that Java is so far the easiest development platform to learn and use. And, its also very extensible. You have standard Java applications that run on any operating system with the java Virtual Machine, but you also have extensions to the language to make it suited for server side development, Selvlets, JavaServer Pages, etc.



    And while Java might not be suited for every application (say, applicatinos that needs to be very fast), its more than good enough for developing applications for the enterprise. And the advantage ? You sacrifice speed for portability. Using Java, you aren't locked down into using one hardware platform - even with GUI (Graphical User Interface) applications. If you decide to switch hardware, you won't need to rewrite all of you applications.



    On top of that, you can, using newer technologies an Jit compilation (Just in Time) get Java to run a lot faster on your setup.



    When I'm creating an application I'm about 30% more efficient when programming in Java than in C++. And this is due to two factors. 1. The API is VERY clean and easy to use. 2. The code is consistent, accross my entire application.



    Both these two point lack in C++. Of course, Obj-C has a nice and consistent structure, but I haven't really had time do look that much into it. And I find the whole "Interface Builder" a bit confusing - basically since I didn't create that code, and hadn't had much experience with it.



    .:BoeManE:.
  • Reply 16 of 50
    cygsidcygsid Posts: 210member
    Quote:

    Originally posted by kim kap sol

    It may be slower on OS X but who really cares? People still use Java?



    Java never became as cross-platform as it was supposed to be thanks to various reasons and thanks to Microsoft. It was never a very good development language either, maybe slightly better than C++ but nothing ground-breaking.



    So the question is, why isn't Java dead?




    what an idiotic response!

    In one short stroke, you displayed your total ignorance of the Java marketplace, and your utter lack of logic:



    1. Java is a huge success story on the server side. Ever heard of J2EE??



    2. Java on the client is actually surprisingly usable nowadays, believe it or not. As others said, a lot of enterprise applications are written in Java now, whole IDEs are in Java (Eclipse comes to mind).



    3. "my roof might be leaking in certain rooms, but who really cares? I never use those rooms anyway..." I love that kind of reasoning: makes me in every time I see them.
  • Reply 17 of 50
    existenceexistence Posts: 991member
    The only thing I can think of, assuming OS X's Java implementation is decent, is the bus speed and crappy G4. The Centrino does have a bus speed that is 3 times faster than the PowerBook's plus a hefty L2 cache. Everyone knows the G4 is a worthless processor 3 years out of date (3 years ago Pentium 3 laptops were where we are now and the P3 is comparable to the G4).



    Anyone try it on a G5?
  • Reply 18 of 50
    webmailwebmail Posts: 639member
    Who cares if java is a bad language or "crap" the whole POINT is that it's on the sites we visit daily. It annoys the crap outta me that the windows 2000 machine next to me that is 800mhz celeron, loads the java applets on pages way faster than my 2ghz OS X machine. It's bull. it shouldn't be this way. It irrates me java was always crippled in os 9, then apple knew this and made a big deal about getting it right in OS X. Sure you'd think because it's *nix now that we'd have it great and speedy. BUT NO. STILL F*CKING SLOW.



    java may suck ass, but it's still there and there is NOT f*cking reason why it shouldn't run better on my mac. Just one reason to let pc lovers stick to there damn PC.
  • Reply 19 of 50
    Quote:

    Originally posted by webmail

    [Bjava may suck ass, but it's still there and there is NOT f*cking reason why it shouldn't run better on my mac. Just one reason to let pc lovers stick to there damn PC. [/B]



    Well, this thread kind of went off at a tangent.



    I'm guessing from the above that the issue is with applets. This is kind of like complaining about Safari because the layout of your favourite beanie baby forum doesn't look right when it's been coded to suit IE on Windows.



    (For those that aren't aware, most applets are written to be compatible with the shitty, non-compliant, out-of-date MSFT JRE because that's all you can assume many PCs will have installed)



    However, if you are in any way interested in Java you can't help but notice the avalanche of switchers in this area e.g.:



    http://www.apple.com/pro/science/gosling/

    (The guy who created Java)



    http://x180.net/

    (The guy who created Tomcat and Ant)



    There are a ton of people developing Java (usually for the server) who are using Mac OS X. I've heard them bitch about a variety of things (e.g. there's no Java 1.5 beta for the Mac yet), but as far as I remember, speed generally isn't one of them.
  • Reply 20 of 50
    kcmackcmac Posts: 1,051member
    Quote:

    Originally posted by stupider...likeafox

    Well, this thread kind of went off at a tangent.



    I'm guessing from the above that the issue is with applets. This is kind of like complaining about Safari because the layout of your favourite beanie baby forum doesn't look right when it's been coded to suit IE on Windows.



    (For those that aren't aware, most applets are written to be compatible with the shitty, non-compliant, out-of-date MSFT JRE because that's all you can assume many PCs will have installed)







    This is what I was thinking but wasn't sure because programming ain't my bag.
Sign In or Register to comment.