How to enable JIT?

Discussion in 'Java' started by Dmitriy Melnik, Feb 21, 2009.

  1. Hi everyone!
    I wanna speed up the program I am creating now. I heard one way to do
    it is to use JIT. Is it possible to enable it on HotSpot VM? If it is
    how can I do that?
    Thanks in advance.
     
    Dmitriy Melnik, Feb 21, 2009
    #1
    1. Advertising

  2. Dmitriy Melnik wrote on 21.02.2009 18:47:
    > Hi everyone!
    > I wanna speed up the program I am creating now. I heard one way to do
    > it is to use JIT. Is it possible to enable it on HotSpot VM? If it is
    > how can I do that?


    It's enabled by default, there is nothing you need to do.

    You can only influence the threshold when bytecode gets compiled into native
    code (after how many executions)

    For details see:

    http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp
     
    Thomas Kellerer, Feb 21, 2009
    #2
    1. Advertising

  3. Dmitriy Melnik

    Arne Vajhøj Guest

    Thomas Kellerer wrote:
    > Dmitriy Melnik wrote on 21.02.2009 18:47:
    >> Hi everyone!
    >> I wanna speed up the program I am creating now. I heard one way to do
    >> it is to use JIT. Is it possible to enable it on HotSpot VM? If it is
    >> how can I do that?

    >
    > It's enabled by default, there is nothing you need to do.


    Not only is id enabled by default - I don't even think it can
    be disabled in newer JVM's.

    Arne
     
    Arne Vajhøj, Feb 21, 2009
    #3
  4. On 21 ÆÅ×, 21:03, Thomas Kellerer <> wrote:
    > Dmitriy Melnik wrote on 21.02.2009 18:47:
    >
    > > Hi everyone!
    > > I wanna speed up the program I am creating now. I heard one way to do
    > > it is to use JIT. Is it possible to enable it on HotSpot VM? If it is
    > > how can I do that?

    >
    > It's enabled by default, there is nothing you need to do.
    >
    > You can only influence the threshold when bytecode gets compiled into native
    > code (after how many executions)
    >
    > For details see:
    >
    > http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp


    Thanks a lot!
     
    Dmitriy Melnik, Feb 21, 2009
    #4
  5. So another question arouse. What VM can provide the best performance?
    The matter is I am creating a cryptographic system and need it run as
    fast as possible.
     
    Dmitriy Melnik, Feb 21, 2009
    #5
  6. Dmitriy Melnik

    Arne Vajhøj Guest

    Dmitriy Melnik wrote:
    > So another question arouse. What VM can provide the best performance?
    > The matter is I am creating a cryptographic system and need it run as
    > fast as possible.


    I don't think the difference is that big. For newer Java versions SUN's
    with -server is approx. as fast as IBM's and BEA's.

    If you test with your specific code, then one of them may
    be a bit faster than the other, but you may find a different
    one to be faster with some other code.

    Arne
     
    Arne Vajhøj, Feb 21, 2009
    #6
  7. On 22 ¬æ¬Ö¬Ó, 01:38, Arne Vajh©ªj <> wrote:
    >
    > I don't think the difference is that big. For newer Java versions SUN's
    > with -server is approx. as fast as IBM's and BEA's.
    >
    > If you test with your specific code, then one of them may
    > be a bit faster than the other, but you may find a different
    > one to be faster with some other code.
    >
    > Arne


    Thanks! I really appreciate your help.
     
    Dmitriy Melnik, Feb 21, 2009
    #7
  8. Dmitriy Melnik

    Lew Guest

    Dmitriy Melnik wrote:
    >>> So another question arouse. What VM can provide the best performance?
    >>> The matter is I am creating a cryptographic system and need it run as
    >>> fast as possible.


    Arne Vajhøj wrote:
    >> I don't think the difference is that big. For newer Java versions SUN's
    >> with -server is approx. as fast as IBM's and BEA's.
    >>
    >> If you test with your specific code, then one of them may
    >> be a bit faster than the other, but you may find a different
    >> one to be faster with some other code.


    Dmitriy Melnik wrote:
    > Thanks! I really appreciate your help.


    Two approaches to increase speed:
    - tune the VM parameters (-server, -X and -XX options);
    - throw hardware at the problem.

    If your application is correctly multithreaded, then additional CPU cores can
    speed things up (subject to Amdahl's Law). More memory can help to a point,
    especially on 64-bit platforms. If I/O is an issue in your application,
    faster disks will help. No optimization of a slow algorithm will improve
    things as much as a faster algorithm, assuming equivalent correctness.

    The dictum for optimization is to measure performance first, then again after
    optimization attempts. Results are often counter-intuitive.

    --
    Lew
    Please trim sigs.
     
    Lew, Feb 21, 2009
    #8
  9. Lew wrote:
    > Dmitriy Melnik wrote:
    > >>> So another question arouse. What VM can provide the best performance?
    > >>> The matter is I am creating a cryptographic system and need it run as
    > >>> fast as possible.

    > Arne Vajhøj wrote:
    > >> I don't think the difference is that big. For newer Java versions SUN's
    > >> with -server is approx. as fast as IBM's and BEA's.

    >
    > >> If you test with your specific code, then one of them may
    > >> be a bit faster than the other, but you may find a different
    > >> one to be faster with some other code.

    > Dmitriy Melnik wrote:
    > > Thanks! I really appreciate your help.

    >
    > Two approaches to increase speed:
    > - tune the VM parameters (-server, -X and -XX options);
    > - throw hardware at the problem.
    >
    > If your application is correctly multithreaded, then additional CPU cores can
    > speed things up (subject to Amdahl's Law).  More memory can help to a point,
    > especially on 64-bit platforms.  If I/O is an issue in your application,
    > faster disks will help.  No optimization of a slow algorithm will improve
    > things as much as a faster algorithm, assuming equivalent correctness.
    >
    > The dictum for optimization is to measure performance first, then again after
    > optimization attempts.  Results are often counter-intuitive.
    >
    > --
    > Lew
    > Please trim sigs.


    Thanks for the useful post. I've already played with VM options a
    little bit. Quadratic sieve factoring algorithm runs about 10% faster
    with the combination of -server and -XX:+AggressiveOpts options.

    Btw, what do you mean by trimming sigs? I'm a complete newbie on
    Usenet.
     
    Dmitriy Melnik, Feb 21, 2009
    #9
  10. Arne Vajhøj wrote on 21.02.2009 19:15:
    > Thomas Kellerer wrote:
    >> Dmitriy Melnik wrote on 21.02.2009 18:47:
    >>> Hi everyone!
    >>> I wanna speed up the program I am creating now. I heard one way to do
    >>> it is to use JIT. Is it possible to enable it on HotSpot VM? If it is
    >>> how can I do that?

    >>
    >> It's enabled by default, there is nothing you need to do.

    >
    > Not only is id enabled by default - I don't even think it can
    > be disabled in newer JVM's.


    Yes you can: -Xint

    http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html
     
    Thomas Kellerer, Feb 21, 2009
    #10
  11. Dmitriy Melnik

    Arne Vajhøj Guest

    Thomas Kellerer wrote:
    > Arne Vajhøj wrote on 21.02.2009 19:15:
    >> Thomas Kellerer wrote:
    >>> Dmitriy Melnik wrote on 21.02.2009 18:47:
    >>>> Hi everyone!
    >>>> I wanna speed up the program I am creating now. I heard one way to do
    >>>> it is to use JIT. Is it possible to enable it on HotSpot VM? If it is
    >>>> how can I do that?
    >>>
    >>> It's enabled by default, there is nothing you need to do.

    >>
    >> Not only is id enabled by default - I don't even think it can
    >> be disabled in newer JVM's.

    >
    > Yes you can: -Xint
    >
    > http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html


    Ah - it is possible. I just noted that -classic was gone.

    Arne
     
    Arne Vajhøj, Feb 21, 2009
    #11
  12. Dmitriy Melnik wrote:
    > Btw, what do you mean by trimming sigs? I'm a complete newbie on
    > Usenet.


    The text below a line consisting of `-- ' is a standard signature; many
    Usenet clients will automatically strip it when replying (as well as
    displaying it in a different manner). There are sometimes people who do
    not use the line to indicate a signature (most often, when it is just a
    person's name); it is still good form to strip those lines from replies.

    --
    Beware of bugs in the above code; I have only proved it correct, not
    tried it. -- Donald E. Knuth
     
    Joshua Cranmer, Feb 21, 2009
    #12
  13. Dmitriy Melnik

    Lew Guest

    Thomas Kellerer wrote:
    >
    >
    > Arne Vajhøj wrote on 21.02.2009 19:15:
    >> Thomas Kellerer wrote:
    >>> Dmitriy Melnik wrote on 21.02.2009 18:47:
    >>>> Hi everyone!
    >>>> I wanna speed up the program I am creating now. I heard one way to do
    >>>> it is to use JIT. Is it possible to enable it on HotSpot VM? If it is
    >>>> how can I do that?
    >>>
    >>> It's enabled by default, there is nothing you need to do.

    >>
    >> Not only is id enabled by default - I don't even think it can
    >> be disabled in newer JVM's.

    >
    > Yes you can: -Xint
    >
    > http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html


    Good point, and presumably very reassuring to the OP, since they want JIT enabled.

    --
    Lew
     
    Lew, Feb 22, 2009
    #13
  14. Dmitriy Melnik

    EJP Guest

    Lew wrote:
    > Two approaches to increase speed:
    > - tune the VM parameters (-server, -X and -XX options);
    > - throw hardware at the problem.


    Specifically, in this case, throw a hardware crypto accelerator at the
    problem. That'll fix it.
     
    EJP, Feb 22, 2009
    #14
  15. EJP wrote:
    > Lew wrote:
    > > Two approaches to increase speed:
    > > - tune the VM parameters (-server, -X and -XX options);
    > > - throw hardware at the problem.

    >
    > Specifically, in this case, throw a hardware crypto accelerator at the
    > problem. That'll fix it.


    I am creating a distributed system for cryptographic computations. I
    am going to use Java to provide scalability among different platforms.
    And also to allow users to add their own algorithms easily. The only
    concern is performance. I wonder if I can achieve that of languages
    like C. A hardware accelerator won't fit in my case I suppose.
     
    Dmitriy Melnik, Feb 22, 2009
    #15
  16. On 22 ÆÅ×, 21:47, Thomas Pornin <> wrote:
    > According to Dmitriy Melnik š<>:
    >
    > > I wonder if I can achieve that of languages like C.

    >
    > For the "symmetric" class of cryptographic algorithms (symmetric
    > encryption, hashing...), a properly optimized Java implementation
    > typically achieves between 25 to 50% fo the performance achieved with a
    > properly optimized C implementation. Which is enough for most purposes.
    > For some algorithms, I observed up to 75% of C speed; the performance
    > killer operation seems to be array accesses, so algorithms which are
    > heavy on array accesses (e.g. RC4) get the worst penalty.
    >
    > For the more numerical primitives (e.g. RSA), mileage varies.
    > java.math.BigInteger is not the fastest package for big integers ever
    > (but it is not bad either).
    >
    > > A hardware accelerator won't fit in my case I suppose.

    >
    > On a general basis, if you stick to the JCA interfaces then you gain
    > support of hardware accelerators "for free".


    Thanks for the reply. Indeed not very encouraging results! I am now
    developing a distributed system for supporting cryptographic and
    cryptoanalytic computations. There are number factorization algorithms
    and other ones that require a lot of processing time. I wonder if it
    is practical to trade off some performance for the simplicity of
    adding new nodes and algorithms to the system which Java is able to
    provide?
     
    Dmitriy Melnik, Feb 22, 2009
    #16
  17. Dmitriy Melnik

    Roedy Green Guest

    On Sat, 21 Feb 2009 11:20:43 -0800 (PST), Dmitriy Melnik
    <> wrote, quoted or indirectly quoted someone
    who said :

    >So another question arouse. What VM can provide the best performance?
    >The matter is I am creating a cryptographic system and need it run as
    >fast as possible.


    Without spending any money, use java -server in the JDK.

    If you want max speed, use Jet with native compilation and global
    optimisation. Read the jet manuals thoroughly. There are many things
    you can tweak to squeeze out a few last drops of performance,
    including fast startup.

    see http://mindprod.com/jgloss/jet.html

    You an try it the evaluation version too see how much it will help
    your app.

    See also http://mindprod.com/jgloss/optimising.html
    http://mindprod.com/jgloss/optimiser.html

    Usually the really big gains come from tweaking your algorithm.
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    One path leads to despair and utter hopelessness. The other,
    to total extinction. Let us pray we have the wisdom to choose correctly.
    ~ Woody Allen .
     
    Roedy Green, Feb 22, 2009
    #17
  18. Dmitriy Melnik

    Lew Guest

    Thomas Pornin wrote:
    > For the "symmetric" class of cryptographic algorithms (symmetric
    > encryption, hashing...), a properly optimized Java implementation
    > typically achieves between 25 to 50% fo the performance achieved with a
    > properly optimized C implementation. Which is enough for most purposes.
    > For some algorithms, I observed up to 75% of C speed; the performance
    > killer operation seems to be array accesses, so algorithms which are
    > heavy on array accesses (e.g. RC4) get the worst penalty.


    Care to show the benchmarks for those claims? What hardware, C and Java
    versions, optimization options, etc., did you use? Did you at least turn on
    maximum optimizations for Java ("-server", GC tuning)? Did you count JVM
    startup time or did you start the timing at the beginning of the relevant
    algorithm? Did you let HotSpot warm up first?

    Quoting such numbers with supporting context is very misleading and irresponsible.

    --
    Lew
     
    Lew, Feb 22, 2009
    #18
  19. Dmitriy Melnik

    Roedy Green Guest

    On Sat, 21 Feb 2009 22:30:34 -0800 (PST), Dmitriy Melnik
    <> wrote, quoted or indirectly quoted someone
    who said :

    >I am creating a distributed system for cryptographic computations. I
    >am going to use Java to provide scalability among different platforms.
    >And also to allow users to add their own algorithms easily. The only
    >concern is performance. I wonder if I can achieve that of languages
    >like C. A hardware accelerator won't fit in my case I suppose.


    Nowadays no problem. The compilers and optimisers are vastly improved.
    Java is in theory a much easier language to optimise than C. It is
    much harder to do things behind the compiler's back in Java.

    When you optimise your algorithms, MEASURE them first to see where the
    time is being chewed up. See http://mindprod.com/jgloss/profiler.html
    Always work on the current bottleneck.

    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    One path leads to despair and utter hopelessness. The other,
    to total extinction. Let us pray we have the wisdom to choose correctly.
    ~ Woody Allen .
     
    Roedy Green, Feb 22, 2009
    #19
  20. Dmitriy Melnik

    Lew Guest

    Lew wrote:
    > Quoting such numbers with supporting context is very misleading and
    > irresponsible.


    Oops, I meant "*without* supporting context".

    --
    Lew
     
    Lew, Feb 22, 2009
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. drv

    JIT Compiler

    drv, Jul 9, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,556
  2. Glen

    Variable JIT of ASPX files?

    Glen, Jun 26, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    1,092
  3. Chris
    Replies:
    0
    Views:
    585
    Chris
    Jul 15, 2003
  4. Alex

    Compiling (JIT and reverse)

    Alex, Oct 29, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    384
    Rajesh.V
    Oct 29, 2003
  5. Patrick
    Replies:
    1
    Views:
    708
Loading...

Share This Page