Alternative to Apple Java VM?

Discussion in 'Mac Programming' started by Desperado, Jul 19, 2006.

  1. macrumors newbie

    May 10, 2005
    Hello there

    I've been coding a while with the Apple VM, Version 1.5 on Tiger but I found
    it to be heavily underoptimized compared to the Sun Hotspot compiler.

    I there an alternative implementation that is known to be faster?

    Thanks for your admittance
  2. Moderator emeritus


    Jul 24, 2002
    Not that I'm aware of. Sun do not distribute a JVM for OSX, I think the cooperate with Apple to release the "official" Apple one. I don't think the IBM one is available either.
  3. macrumors regular

    May 9, 2005
    Boston, MA (I miss Willoughby, Ohio)
  4. thread starter macrumors newbie

    May 10, 2005
    That disappoints me. :(
    How about the Intel-Version? Does it include the original Sun optimizations?
  5. Moderator


    Staff Member

    Dec 7, 2002
    Whakatane, New Zealand
    Apparently Sun are going to open-source Java, once that happens you'll probably start to see more VMs popping up.
  6. macrumors member


    May 1, 2003
    Grand Rapids, MI
    You're already using HotSpot

    Apple's JVM is licensed from Sun and already uses the HotSpot compiler:

    [chrisg5:~] % java -version
    java version "1.5.0_06"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-112)
    Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode, sharing)
    Are you seeing slowness in GUI or server apps? GUI apps use Quartz so they may be slower but prettier than the same apps run on Windows or Linux.

    You might try starting up with
    java -server
    java -client
    to experiment with the JVM's compilation-versus-interpretation tradeoff options.
  7. macrumors 6502a

    Jun 17, 2003
    If the original poster is commenting about the Apple JVM running on PPC, then you are correct in saying that the JVM is already using HotSpot. However the PPC operation of the JIT is written by Apple developers working at Cupertino. Hotspot is geared towards x86 and SPARC just in time compilation. The minimal work that Apple does to get the JIT working on PPC isn't likely to result in optimal performance.

    If the original poster is commenting about Apple JVM performance when running on Intel hardware then there are fewer reasons for bad performance. Presumably most, if not all, of the x86 JIT behavior can be directly reused on OS X for intel.
  8. macrumors 68040


    Apr 8, 2004
    I hope the OP is talking about PPC (it helps to give details like this) because I found Java compilation and execution to be about three times faster on my 17" iMac (Intel 1.83GHz Core Duo) than on my colleague's 1.5 GHz PowerBook.

    I find that it's about as fast at compiling in OS X on Intel Macs as it is in Linux (my previous OS of choice for Java programming), and about 50% faster than Windows, using the same machine for Linux and Windows (a laptop with a 2.26GHz Pentium M - the dual core doesn't affect the compilation time, and the slow Windows is most likely due to the on-access virus checker my employer forces me to use.)
  9. macrumors regular

    Mar 14, 2006
    Washington, DC
    "Underoptimized" as in...?
    As previous posters have stated, Apple's JVM uses the same Hotspot JIT compiler as the Windows version does.
    Both on my MacBook Pro and a dual 2.5GHz G5 Java apps feel completely native. For the record, I code in IntelliJ IDEA, run Azureus Bittorrent client, and a database program I have written myself.
    On older G4 machines Java was indeed slow... But it was not the compiler's fault.
  10. macrumors 6502a

    Jun 17, 2003
    Possibly because the JIT is designed to compile to x86 instructions. The PPC instructions that Apple modified the JIT to produce to replace the x86 instructions are very likely to be less than optimal for the high level operation being performed. This lack of optimization is likely because there isn't a clean mapping between x86 and PPC instructions.
  11. thread starter macrumors newbie

    May 10, 2005
    Yes, I referred to the Power PC Version. And I thought that only the client
    hotspot was ported and not the server vm?

Share This Page