[armedbear-cvs] r12394 - trunk/abcl/src/org/armedbear/lisp

Erik Huelsmann ehuelsmann at common-lisp.net
Sat Jan 23 13:40:39 UTC 2010


Author: ehuelsmann
Date: Sat Jan 23 08:40:34 2010
New Revision: 12394

Log:
Remove premature optimization: new array creation is faster than
  field access;  at the same time, don't create too many new arrays.

Modified:
   trunk/abcl/src/org/armedbear/lisp/Closure.java

Modified: trunk/abcl/src/org/armedbear/lisp/Closure.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Closure.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Closure.java	Sat Jan 23 08:40:34 2010
@@ -54,15 +54,10 @@
   private static final int STATE_REST     = 3;
   private static final int STATE_AUX      = 4;
 
-  private static final Parameter[] emptyParameterArray;
-  static 
-    {
-        emptyParameterArray = new Parameter[0];
-    }
-  private Parameter[] requiredParameters = emptyParameterArray;
-  private Parameter[] optionalParameters = emptyParameterArray;
-  private Parameter[] keywordParameters = emptyParameterArray;
-  private Parameter[] auxVars = emptyParameterArray;
+  private Parameter[] requiredParameters = new Parameter[0];
+  private Parameter[] optionalParameters = requiredParameters;
+  private Parameter[] keywordParameters = requiredParameters;
+  private Parameter[] auxVars = requiredParameters;
   private final LispObject body;
   private final LispObject executionBody;
   private final Environment environment;
@@ -75,12 +70,7 @@
   private int minArgs;
   private int maxArgs;
 
-  private static final Symbol[] emptySymbolArray;
-  static 
-    {
-        emptySymbolArray = new Symbol[0];
-    }
-  private Symbol[] variables = emptySymbolArray;
+  private Symbol[] variables = new Symbol[0];
   private LispObject specials = NIL;
 
   private boolean bindInitForms;




More information about the armedbear-cvs mailing list