Re: 8152910: Get performance improvement with Stable annotation

2018-10-10 Thread Joseph D. Darcy

Looks fine Brian; thanks,

-Joe

On 10/1/2018 2:31 PM, Brian Burkhalter wrote:

Please review at your convenience:

https://bugs.openjdk.java.net/browse/JDK-8152910

JMH benchmarks do show a slight but measurable performance improvement with the 
below patch applied.

Thanks,

Brian

--- a/src/java.base/share/classes/java/math/BigInteger.java
+++ b/src/java.base/share/classes/java/math/BigInteger.java
@@ -41,6 +41,7 @@
  import jdk.internal.math.DoubleConsts;
  import jdk.internal.math.FloatConsts;
  import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.vm.annotation.Stable;
  
  /**

   * Immutable arbitrary-precision integers.  All operations behave as if
@@ -1219,8 +1220,10 @@
   * Initialize static constant array when class is loaded.
   */
  private static final int MAX_CONSTANT = 16;
-private static BigInteger posConst[] = new BigInteger[MAX_CONSTANT+1];
-private static BigInteger negConst[] = new BigInteger[MAX_CONSTANT+1];
+@Stable
+private static final BigInteger posConst[] = new 
BigInteger[MAX_CONSTANT+1];
+@Stable
+private static final BigInteger negConst[] = new 
BigInteger[MAX_CONSTANT+1];





Re: 8152910: Get performance improvement with Stable annotation

2018-10-01 Thread Brian Burkhalter
Hi Rémi,

You’re right: that was stupid, especially given the work currently being done 
for https://bugs.openjdk.java.net/browse/JDK-8211300.

Will change.

Thanks,

Brian

On Oct 1, 2018, at 2:46 PM, Remi Forax  wrote:

> can you move the [] to the right place at the same time, to use the java 
> syntax not the C one.
> i.e.
>   @Stable
>   private static final BigInteger[] posConst = new BigInteger[MAX_CONSTANT+1];
> instead of
>   @Stable
>   private static final BigInteger posConst[] = new BigInteger[MAX_CONSTANT+1];



Re: 8152910: Get performance improvement with Stable annotation

2018-10-01 Thread Remi Forax
Hi Brian,
can you move the [] to the right place at the same time, to use the java syntax 
not the C one.
i.e.
   @Stable
   private static final BigInteger[] posConst = new BigInteger[MAX_CONSTANT+1];
instead of
   @Stable
   private static final BigInteger posConst[] = new BigInteger[MAX_CONSTANT+1];

cheers,
Rémi

- Mail original -
> De: "Brian Burkhalter" 
> À: "core-libs-dev" 
> Envoyé: Lundi 1 Octobre 2018 23:31:22
> Objet: 8152910: Get performance improvement with Stable annotation

> Please review at your convenience:
> 
> https://bugs.openjdk.java.net/browse/JDK-8152910
> 
> JMH benchmarks do show a slight but measurable performance improvement with 
> the
> below patch applied.
> 
> Thanks,
> 
> Brian
> 
> --- a/src/java.base/share/classes/java/math/BigInteger.java
> +++ b/src/java.base/share/classes/java/math/BigInteger.java
> @@ -41,6 +41,7 @@
> import jdk.internal.math.DoubleConsts;
> import jdk.internal.math.FloatConsts;
> import jdk.internal.HotSpotIntrinsicCandidate;
> +import jdk.internal.vm.annotation.Stable;
> 
> /**
>  * Immutable arbitrary-precision integers.  All operations behave as if
> @@ -1219,8 +1220,10 @@
>  * Initialize static constant array when class is loaded.
>  */
> private static final int MAX_CONSTANT = 16;
> -private static BigInteger posConst[] = new BigInteger[MAX_CONSTANT+1];
> -private static BigInteger negConst[] = new BigInteger[MAX_CONSTANT+1];
> +@Stable
> +private static final BigInteger posConst[] = new
> BigInteger[MAX_CONSTANT+1];
> +@Stable
> +private static final BigInteger negConst[] = new
> BigInteger[MAX_CONSTANT+1];


8152910: Get performance improvement with Stable annotation

2018-10-01 Thread Brian Burkhalter
Please review at your convenience:

https://bugs.openjdk.java.net/browse/JDK-8152910

JMH benchmarks do show a slight but measurable performance improvement with the 
below patch applied.

Thanks,

Brian

--- a/src/java.base/share/classes/java/math/BigInteger.java
+++ b/src/java.base/share/classes/java/math/BigInteger.java
@@ -41,6 +41,7 @@
 import jdk.internal.math.DoubleConsts;
 import jdk.internal.math.FloatConsts;
 import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.vm.annotation.Stable;
 
 /**
  * Immutable arbitrary-precision integers.  All operations behave as if
@@ -1219,8 +1220,10 @@
  * Initialize static constant array when class is loaded.
  */
 private static final int MAX_CONSTANT = 16;
-private static BigInteger posConst[] = new BigInteger[MAX_CONSTANT+1];
-private static BigInteger negConst[] = new BigInteger[MAX_CONSTANT+1];
+@Stable
+private static final BigInteger posConst[] = new 
BigInteger[MAX_CONSTANT+1];
+@Stable
+private static final BigInteger negConst[] = new 
BigInteger[MAX_CONSTANT+1];