wu-sheng commented on a change in pull request #2930: One more time for heigher 
performance
URL: https://github.com/apache/skywalking/pull/2930#discussion_r296569009
 
 

 ##########
 File path: 
apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/common/AtomicRangeInteger.java
 ##########
 @@ -20,28 +20,32 @@
 package org.apache.skywalking.apm.commons.datacarrier.common;
 
 import java.io.Serializable;
-import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicIntegerArray;
 
 /**
- * Created by wusheng on 2016/10/25.
+ * Created by lkxiaolou
  */
 public class AtomicRangeInteger extends Number implements Serializable {
     private static final long serialVersionUID = -4099792402691141643L;
-    private AtomicInteger value;
+    private AtomicIntegerArray values;
+
+    private static final int VALUE_OFFSET = 15;
+
     private int startValue;
     private int endValue;
 
     public AtomicRangeInteger(int startValue, int maxValue) {
-        this.value = new AtomicInteger(startValue);
+        this.values = new AtomicIntegerArray(31);
 
 Review comment:
   Cache line should be 64 bytes in 64-bits OS. Then as `int[] array`.
   1. 12 bytes(in OS 64-bits) for the array ref
   1. 4 bytes(int) * 13(size)
   
   Am I missing anything? Why set 31? And why set `VALUE_OFFSET` to 15? 
Compatible for 32-bit OS?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to