commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcu...@apache.org
Subject svn commit: r1530807 - /commons/sandbox/javaflow/trunk/src/main/java/org/apache/commons/javaflow/bytecode/Stack.java
Date Wed, 09 Oct 2013 22:01:22 GMT
Author: tcurdt
Date: Wed Oct  9 22:01:21 2013
New Revision: 1530807

URL: http://svn.apache.org/r1530807
Log:
big performance improvement through more efficient logging, patch by Teofilis Martisius

Modified:
    commons/sandbox/javaflow/trunk/src/main/java/org/apache/commons/javaflow/bytecode/Stack.java

Modified: commons/sandbox/javaflow/trunk/src/main/java/org/apache/commons/javaflow/bytecode/Stack.java
URL: http://svn.apache.org/viewvc/commons/sandbox/javaflow/trunk/src/main/java/org/apache/commons/javaflow/bytecode/Stack.java?rev=1530807&r1=1530806&r2=1530807&view=diff
==============================================================================
--- commons/sandbox/javaflow/trunk/src/main/java/org/apache/commons/javaflow/bytecode/Stack.java
(original)
+++ commons/sandbox/javaflow/trunk/src/main/java/org/apache/commons/javaflow/bytecode/Stack.java
Wed Oct  9 22:01:21 2013
@@ -83,7 +83,9 @@ public class Stack implements Serializab
         }
         
         final double d = dstack[--dTop];
-        log.debug("pop double " + d + " " + getStats());
+        if (log.isDebugEnabled()) {
+            log.debug("pop double " + d + " " + getStats());
+        }
         return d;
     }
 
@@ -97,7 +99,9 @@ public class Stack implements Serializab
         }
         
         final float f = fstack[--fTop];
-        log.debug("pop float " + f + " " + getStats());
+        if (log.isDebugEnabled()) {
+            log.debug("pop float " + f + " " + getStats());
+        }
         return f;
     }
 
@@ -111,7 +115,9 @@ public class Stack implements Serializab
         }
         
         final int i = istack[--iTop];
-        log.debug("pop int " + i + " " + getStats());
+        if (log.isDebugEnabled()) {
+            log.debug("pop int " + i + " " + getStats());
+        }
         return i;
     }
 
@@ -125,7 +131,9 @@ public class Stack implements Serializab
         }
         
         final long l = lstack[--lTop];
-        log.debug("pop long " + l + " " + getStats());
+        if (log.isDebugEnabled()) {
+            log.debug("pop long " + l + " " + getStats());  
+        }
         return l;
     }
 
@@ -174,7 +182,9 @@ public class Stack implements Serializab
     }
 
     public void pushDouble(double d) {
-        log.debug("push double " + d + " " + getStats());
+        if (log.isDebugEnabled()) {
+            log.debug("push double " + d + " " + getStats());
+        }
 
         if (dTop == dstack.length) {
             double[] hlp = new double[Math.max(8,dstack.length*2)];
@@ -185,7 +195,9 @@ public class Stack implements Serializab
     }
 
     public void pushFloat(float f) {
-        log.debug("push float " + f + " " + getStats());
+        if (log.isDebugEnabled()) {
+            log.debug("push float " + f + " " + getStats());
+        }
         
         if (fTop == fstack.length) {
             float[] hlp = new float[Math.max(8,fstack.length*2)];
@@ -196,7 +208,9 @@ public class Stack implements Serializab
     }
 
     public void pushInt(int i) {
-        log.debug("push int " + i + " " + getStats());
+        if (log.isDebugEnabled()) {
+            log.debug("push int " + i + " " + getStats());
+        }
 
         if (iTop == istack.length) {
             int[] hlp = new int[Math.max(8,istack.length*2)];
@@ -207,7 +221,9 @@ public class Stack implements Serializab
     }
 
     public void pushLong(long l) {
-        log.debug("push long " + l + " " + getStats());
+        if (log.isDebugEnabled()) {
+            log.debug("push long " + l + " " + getStats());
+        }
         
         if (lTop == lstack.length) {
             long[] hlp = new long[Math.max(8,lstack.length*2)];
@@ -271,14 +287,18 @@ public class Stack implements Serializab
     }
 
     private String getStats() {
-        final StringBuffer sb = new StringBuffer();
-        sb.append("i[").append(iTop).append("],");
-        sb.append("l[").append(lTop).append("],");
-        sb.append("d[").append(dTop).append("],");
-        sb.append("f[").append(fTop).append("],");
-        sb.append("o[").append(oTop).append("],");
-        sb.append("r[").append(rTop).append("]");
-        return sb.toString();
+        if (log.isDebugEnabled()) {
+            final StringBuffer sb = new StringBuffer();
+            sb.append("i[").append(iTop).append("],");
+            sb.append("l[").append(lTop).append("],");
+            sb.append("d[").append(dTop).append("],");
+            sb.append("f[").append(fTop).append("],");
+            sb.append("o[").append(oTop).append("],");
+            sb.append("r[").append(rTop).append("]");
+            return sb.toString();
+        } else {
+            return "enable debug loglevel to see stats";
+        }
     }
 
     private String getContent() {



Mime
View raw message