Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4449911

REGRESSION: BigInteger.pow() painfully slow for large exponents (1.3 vs. 1.2.x)

XMLWordPrintable

    • beta2
    • generic
    • generic
    • Verified



      Name: krC82822 Date: 04/24/2001


      24 Apr 2001, eval1127@eng -- 1.3.x/1.4.x significantly slower
      than 1.2.x. See Comments section.
      ----------
      java version "1.3.0_02"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_02)
      Java HotSpot(TM) Client VM (build 1.3.0_02, mixed mode)

      Sample program:

      import java.math.*;

      public class powtest
      {
          public static void main(String[] args)
          {
              long t1 = System.currentTimeMillis();

              BigInteger result = BigInteger.valueOf(10).pow(65536);

              System.out.println("runtime: " +
                 (System.currentTimeMillis()-t1)/1000.0 + " secs");
          }
      }

      System is: W2K Server SP1 AMD 550MHz

      Running against JDK 1.3.0_02 it takes about 65 seconds. If running against JDK
      1.2.2_006 it takes 0.5 seconds. Someone seems to have badly "over-optimized"
      this ...

      (Review ID: 123144)
      ======================================================================

            darcy Joe Darcy
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: