Index: src/org/jruby/RubyKernel.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/RubyKernel.java,v
retrieving revision 1.11.2.1
diff -u -r1.11.2.1 RubyKernel.java
--- src/org/jruby/RubyKernel.java	2 Jan 2006 07:07:09 -0000	1.11.2.1
+++ src/org/jruby/RubyKernel.java	29 Jan 2006 14:54:15 -0000
@@ -442,8 +442,8 @@
         RubyArray localVariables = runtime.newArray();
 
         if (runtime.getCurrentContext().getCurrentScope().getLocalNames() != null) {
-            for (int i = 2; i < runtime.getCurrentContext().getCurrentScope().getLocalNames().size(); i++) {
-				String variableName = (String) runtime.getCurrentContext().getCurrentScope().getLocalNames().get(i);
+            for (int i = 2; i < runtime.getCurrentContext().getCurrentScope().getLocalNames().length; i++) {
+				String variableName = (String) runtime.getCurrentContext().getCurrentScope().getLocalNames()[i];
                 if (variableName != null) {
                     localVariables.append(runtime.newString(variableName));
                 }
Index: src/org/jruby/ast/ScopeNode.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/ast/ScopeNode.java,v
retrieving revision 1.6.2.1
diff -u -r1.6.2.1 ScopeNode.java
--- src/org/jruby/ast/ScopeNode.java	2 Jan 2006 07:07:11 -0000	1.6.2.1
+++ src/org/jruby/ast/ScopeNode.java	29 Jan 2006 14:54:15 -0000
@@ -51,10 +51,10 @@
 public class ScopeNode extends Node {
     static final long serialVersionUID = 3694868125861223886L;
 
-    private final List localNames;
+    private final String[] localNames;
     private final Node bodyNode;
 
-    public ScopeNode(ISourcePosition position, List table, Node bodyNode) {
+    public ScopeNode(ISourcePosition position, String[] table, Node bodyNode) {
         super(position);
         this.localNames =  table;
         this.bodyNode = bodyNode;
@@ -80,7 +80,7 @@
      * Gets the localNames.
      * @return Returns a List
      */
-    public List getLocalNames() {
+    public String[] getLocalNames() {
         return localNames;
     }
     
Index: src/org/jruby/javasupport/bsf/JRubyEngine.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/javasupport/bsf/JRubyEngine.java,v
retrieving revision 1.23.2.1
diff -u -r1.23.2.1 JRubyEngine.java
--- src/org/jruby/javasupport/bsf/JRubyEngine.java	2 Jan 2006 07:07:15 -0000	1.23.2.1
+++ src/org/jruby/javasupport/bsf/JRubyEngine.java	29 Jan 2006 14:54:15 -0000
@@ -67,7 +67,9 @@
         ThreadContext threadContext = runtime.getCurrentContext();
         try {
             // add a new method conext
-            threadContext.preBsfApply(paramNames);
+            String[] names = new String[paramNames.size()];
+            paramNames.toArray(names);
+            threadContext.preBsfApply(names);
             Scope scope = threadContext.getCurrentScope();
 
             // set global variables
Index: src/org/jruby/main/ASTSerializer.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/main/ASTSerializer.java,v
retrieving revision 1.11.2.2
diff -u -r1.11.2.2 ASTSerializer.java
--- src/org/jruby/main/ASTSerializer.java	22 Jan 2006 05:05:39 -0000	1.11.2.2
+++ src/org/jruby/main/ASTSerializer.java	29 Jan 2006 14:54:15 -0000
@@ -72,7 +72,7 @@
     public static void serialize(File input, IAstEncoder encoder) throws IOException {
         Reader reader = new BufferedReader(new FileReader(input));
         RubyParserConfiguration config = new RubyParserConfiguration();
-        config.setLocalVariables(new ArrayList());
+        config.setLocalVariables(new String[0]);
 
         DefaultRubyParser parser = null;
         RubyParserResult result = null;
Index: src/org/jruby/parser/DefaultRubyParser.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/parser/DefaultRubyParser.java,v
retrieving revision 1.21.2.2
diff -u -r1.21.2.2 DefaultRubyParser.java
--- src/org/jruby/parser/DefaultRubyParser.java	22 Jan 2006 05:05:38 -0000	1.21.2.2
+++ src/org/jruby/parser/DefaultRubyParser.java	29 Jan 2006 14:54:17 -0000
@@ -1086,7 +1086,7 @@
 case 21:
 					// line 424 "DefaultRubyParser.y"
   {
-                    support.getResult().addBeginNode(new ScopeNode(getPosition(((Token)yyVals[-4+yyTop]), true), ((LocalNamesElement) support.getLocalNames().peek()).getNames(), ((Node)yyVals[-1+yyTop])));
+                    support.getResult().addBeginNode(new ScopeNode(getPosition(((Token)yyVals[-4+yyTop]), true), ((LocalNamesElement) support.getLocalNames().peek()).getNamesArray(), ((Node)yyVals[-1+yyTop])));
                     support.getLocalNames().pop();
                     yyVal = null; /*XXX 0;*/
                 }
@@ -2536,7 +2536,7 @@
 case 307:
 					// line 1289 "DefaultRubyParser.y"
   {
-                    yyVal = new ClassNode(support.union(((Token)yyVals[-5+yyTop]), ((Token)yyVals[0+yyTop])), ((Colon2Node)yyVals[-4+yyTop]), new ScopeNode(getRealPosition(((Node)yyVals[-1+yyTop])), ((LocalNamesElement) support.getLocalNames().peek()).getNames(), ((Node)yyVals[-1+yyTop])), ((Node)yyVals[-3+yyTop]));
+                    yyVal = new ClassNode(support.union(((Token)yyVals[-5+yyTop]), ((Token)yyVals[0+yyTop])), ((Colon2Node)yyVals[-4+yyTop]), new ScopeNode(getRealPosition(((Node)yyVals[-1+yyTop])), ((LocalNamesElement) support.getLocalNames().peek()).getNamesArray(), ((Node)yyVals[-1+yyTop])), ((Node)yyVals[-3+yyTop]));
                     /* $<Node>$.setLine($<Integer>4.intValue());*/
                     support.getLocalNames().pop();
                 }
@@ -2559,7 +2559,7 @@
 case 310:
 					// line 1302 "DefaultRubyParser.y"
   {
-                    yyVal = new SClassNode(support.union(((Token)yyVals[-7+yyTop]), ((Token)yyVals[0+yyTop])), ((Node)yyVals[-5+yyTop]), new ScopeNode(getRealPosition(((Node)yyVals[-1+yyTop])), ((LocalNamesElement) support.getLocalNames().peek()).getNames(), ((Node)yyVals[-1+yyTop])));
+                    yyVal = new SClassNode(support.union(((Token)yyVals[-7+yyTop]), ((Token)yyVals[0+yyTop])), ((Node)yyVals[-5+yyTop]), new ScopeNode(getRealPosition(((Node)yyVals[-1+yyTop])), ((LocalNamesElement) support.getLocalNames().peek()).getNamesArray(), ((Node)yyVals[-1+yyTop])));
                     support.getLocalNames().pop();
                     support.setInDef(((Boolean)yyVals[-4+yyTop]).booleanValue());
                     support.setInSingle(((Integer)yyVals[-2+yyTop]).intValue());
@@ -2578,7 +2578,7 @@
 case 312:
 					// line 1315 "DefaultRubyParser.y"
   {
-                    yyVal = new ModuleNode(support.union(((Token)yyVals[-4+yyTop]), ((Token)yyVals[0+yyTop])), ((Colon2Node)yyVals[-3+yyTop]), new ScopeNode(getRealPosition(((Node)yyVals[-1+yyTop])), ((LocalNamesElement) support.getLocalNames().peek()).getNames(), ((Node)yyVals[-1+yyTop])));
+                    yyVal = new ModuleNode(support.union(((Token)yyVals[-4+yyTop]), ((Token)yyVals[0+yyTop])), ((Colon2Node)yyVals[-3+yyTop]), new ScopeNode(getRealPosition(((Node)yyVals[-1+yyTop])), ((LocalNamesElement) support.getLocalNames().peek()).getNamesArray(), ((Node)yyVals[-1+yyTop])));
                     /* $<Node>$.setLine($<Integer>3.intValue());*/
                     support.getLocalNames().pop();
                 }
@@ -2599,7 +2599,7 @@
 		      /* was in old jruby grammar support.getClassNest() !=0 || IdUtil.isAttrSet($2) ? Visibility.PUBLIC : Visibility.PRIVATE); */
                     /* NOEX_PRIVATE for toplevel */
                     yyVal = new DefnNode(support.union(((Token)yyVals[-5+yyTop]), ((Token)yyVals[0+yyTop])), new ArgumentNode(((ISourcePositionHolder)yyVals[-4+yyTop]).getPosition(), (String) ((Token)yyVals[-4+yyTop]).getValue()), ((Node)yyVals[-2+yyTop]),
-		                      new ScopeNode(getRealPosition(((Node)yyVals[-1+yyTop])), ((LocalNamesElement) support.getLocalNames().peek()).getNames(), ((Node)yyVals[-1+yyTop])), Visibility.PRIVATE);
+		                      new ScopeNode(getRealPosition(((Node)yyVals[-1+yyTop])), ((LocalNamesElement) support.getLocalNames().peek()).getNamesArray(), ((Node)yyVals[-1+yyTop])), Visibility.PRIVATE);
                     /* $<Node>$.setPosFrom($4);*/
                     support.getLocalNames().pop();
                     support.setInDef(false);
@@ -2623,7 +2623,7 @@
 case 317:
 					// line 1346 "DefaultRubyParser.y"
   {
-                    yyVal = new DefsNode(support.union(((Token)yyVals[-8+yyTop]), ((Token)yyVals[0+yyTop])), ((Node)yyVals[-7+yyTop]), (String) ((Token)yyVals[-4+yyTop]).getValue(), ((Node)yyVals[-2+yyTop]), new ScopeNode(getPosition(null), ((LocalNamesElement) support.getLocalNames().peek()).getNames(), ((Node)yyVals[-1+yyTop])));
+                    yyVal = new DefsNode(support.union(((Token)yyVals[-8+yyTop]), ((Token)yyVals[0+yyTop])), ((Node)yyVals[-7+yyTop]), (String) ((Token)yyVals[-4+yyTop]).getValue(), ((Node)yyVals[-2+yyTop]), new ScopeNode(getPosition(null), ((LocalNamesElement) support.getLocalNames().peek()).getNamesArray(), ((Node)yyVals[-1+yyTop])));
                     /* $<Node>$.setPosFrom($2);*/
                     support.getLocalNames().pop();
                     support.setInSingle(support.getInSingle() - 1);
Index: src/org/jruby/parser/LocalNamesElement.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/parser/LocalNamesElement.java,v
retrieving revision 1.11.2.1
diff -u -r1.11.2.1 LocalNamesElement.java
--- src/org/jruby/parser/LocalNamesElement.java	2 Jan 2006 07:07:13 -0000	1.11.2.1
+++ src/org/jruby/parser/LocalNamesElement.java	29 Jan 2006 14:54:17 -0000
@@ -38,6 +38,7 @@
  * @author  jpetersen
  */
 public class LocalNamesElement {
+    private static final String[] EMPTY_NAMES = new String[0];
     private List localNames;
     private int blockLevel;
 
@@ -123,6 +124,17 @@
     public List getNames() {
         return localNames != null ? localNames : Collections.EMPTY_LIST;
     }
+    
+    public String[] getNamesArray() {
+        if (localNames == null) {
+            return EMPTY_NAMES;
+        }
+        
+        String[] names = new String[localNames.size()];
+        localNames.toArray(names);
+        
+        return names;
+    }
 
     /**
      * Sets the localNames.
Index: src/org/jruby/parser/Parser.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/parser/Parser.java,v
retrieving revision 1.11.2.1
diff -u -r1.11.2.1 Parser.java
--- src/org/jruby/parser/Parser.java	2 Jan 2006 07:07:14 -0000	1.11.2.1
+++ src/org/jruby/parser/Parser.java	29 Jan 2006 14:54:17 -0000
@@ -93,10 +93,12 @@
     private void expandLocalVariables(List localVariables) {
         int oldSize = 0;
         if (runtime.getCurrentContext().getCurrentScope().getLocalNames() != null) {
-            oldSize = runtime.getCurrentContext().getCurrentScope().getLocalNames().size();
+            oldSize = runtime.getCurrentContext().getCurrentScope().getLocalNames().length;
         }
         List newNames = localVariables.subList(oldSize, localVariables.size());
-        runtime.getCurrentContext().getCurrentScope().addLocalVariables(newNames);
+        String[] newNamesArray = new String[newNames.size()];
+        newNames.toArray(newNamesArray);
+        runtime.getCurrentContext().getCurrentScope().addLocalVariables(newNamesArray);
     }
 
     private boolean hasNewLocalVariables(RubyParserResult result) {
@@ -106,7 +108,7 @@
         }
         int oldSize = 0;
         if (runtime.getCurrentContext().getCurrentScope().hasLocalVariables()) {
-            oldSize = runtime.getCurrentContext().getCurrentScope().getLocalNames().size();
+            oldSize = runtime.getCurrentContext().getCurrentScope().getLocalNames().length;
         }
         return newSize > oldSize;
     }
Index: src/org/jruby/parser/ParserSupport.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/parser/ParserSupport.java,v
retrieving revision 1.21.2.2
diff -u -r1.21.2.2 ParserSupport.java
--- src/org/jruby/parser/ParserSupport.java	22 Jan 2006 05:05:38 -0000	1.21.2.2
+++ src/org/jruby/parser/ParserSupport.java	29 Jan 2006 14:54:18 -0000
@@ -33,6 +33,8 @@
 package org.jruby.parser;
 
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Stack;
@@ -588,10 +590,12 @@
     public void initTopLocalVariables() {
         localNamesStack.push(new LocalNamesElement());
 
-        List names = configuration.getLocalVariables();
-        if (names != null && names.size() > 0) {
+        String[] names = configuration.getLocalVariables();
+        if (names != null && names.length > 0) {
 			LocalNamesElement localNames = (LocalNamesElement) localNamesStack.peek();
-            localNames.setNames(new ArrayList(names));
+            List namesList = new ArrayList(names.length);
+            for (int i = 0; i < names.length; i++) namesList.add(names[i]);
+            localNames.setNames(namesList);
         }
     }
 
Index: src/org/jruby/parser/RubyParserConfiguration.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/parser/RubyParserConfiguration.java,v
retrieving revision 1.3.2.2
diff -u -r1.3.2.2 RubyParserConfiguration.java
--- src/org/jruby/parser/RubyParserConfiguration.java	22 Jan 2006 05:05:38 -0000	1.3.2.2
+++ src/org/jruby/parser/RubyParserConfiguration.java	29 Jan 2006 14:54:18 -0000
@@ -29,16 +29,15 @@
  ***** END LICENSE BLOCK *****/
 package org.jruby.parser;
 
-import java.util.List;
 
 public class RubyParserConfiguration {
-    private List localVariables;
+    private String[] localVariables;
 
     /**
      * Gets the localVariables.
      * @return Returns a List
      */
-    public List getLocalVariables() {
+    public String[] getLocalVariables() {
         return localVariables;
     }
 
@@ -46,7 +45,7 @@
      * Sets the localVariables.
      * @param localVariables The localVariables to set
      */
-    public void setLocalVariables(List localVariables) {
+    public void setLocalVariables(String[] localVariables) {
         this.localVariables = localVariables;
     }
 }
Index: src/org/jruby/runtime/Frame.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/runtime/Frame.java,v
retrieving revision 1.9.2.3
diff -u -r1.9.2.3 Frame.java
--- src/org/jruby/runtime/Frame.java	6 Jan 2006 00:00:40 -0000	1.9.2.3
+++ src/org/jruby/runtime/Frame.java	29 Jan 2006 14:54:18 -0000
@@ -30,8 +30,6 @@
  ***** END LICENSE BLOCK *****/
 package org.jruby.runtime;
 
-import java.util.List;
-
 import org.jruby.IRuby;
 import org.jruby.RubyModule;
 import org.jruby.ast.Node;
@@ -157,7 +155,7 @@
         this.self = self;
     }
     
-    void newScope(List localNames) {
+    void newScope(String[] localNames) {
         setScope(new Scope(runtime, localNames));
     }
     
Index: src/org/jruby/runtime/Scope.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/runtime/Scope.java,v
retrieving revision 1.10.2.1
diff -u -r1.10.2.1 Scope.java
--- src/org/jruby/runtime/Scope.java	2 Jan 2006 07:07:09 -0000	1.10.2.1
+++ src/org/jruby/runtime/Scope.java	29 Jan 2006 14:54:18 -0000
@@ -55,8 +55,10 @@
 
     private IRubyObject rubyNil;
 
-    private List localNames = null;
-	private List localValues = null;
+    //private List localNames = null;
+	//private List localValues = null;
+    private String[] localNames;
+    private IRubyObject[] localValues;
 
     private Visibility visibility = Visibility.PUBLIC; // Constants.SCOPE_PRIVATE; ? // Same as default for top level...just in case
 
@@ -64,7 +66,7 @@
         this.rubyNil = runtime.getNil();
     }
 	
-	public Scope(IRuby runtime, List names) {
+	public Scope(IRuby runtime, String[] names) {
 		this(runtime);
 		
 		resetLocalVariables(names);
@@ -74,7 +76,7 @@
      * Gets the localNames.
      * @return Returns a NameList
      */
-    public List getLocalNames() {
+    public String[] getLocalNames() {
         return localNames;
     }
 
@@ -82,38 +84,53 @@
      * Sets the localNames.
      * @param someLocalNames The localNames to set
      */
-    public void resetLocalVariables(List someLocalNames) {
-        if (someLocalNames == null || someLocalNames.isEmpty()) {
+    public void resetLocalVariables(String[] someLocalNames) {
+        if (someLocalNames == null || someLocalNames.length == 0) {
             this.localNames = null;
             this.localValues = null;
         } else {
             this.localNames = someLocalNames;
-            this.localValues = new ArrayList(Collections.nCopies(someLocalNames.size(), rubyNil));
+            this.localValues = new IRubyObject[someLocalNames.length];
+            Arrays.fill(localValues, rubyNil);
         }
     }
 
-    public void addLocalVariables(List someLocalNames) {
-        if (this.localNames == null || this.localNames.isEmpty()) {
-            this.localNames = new ArrayList(someLocalNames.size());
-            this.localValues = new ArrayList(someLocalNames.size());
+    public void addLocalVariables(String[] someLocalNames) {
+        if (this.localNames == null || this.localNames.length == 0) {
+            this.localNames = someLocalNames;
+            this.localValues = new IRubyObject[someLocalNames.length];
+            Arrays.fill(localValues, rubyNil);
+            
+            System.arraycopy(someLocalNames, 0, localNames, 0, someLocalNames.length);
+        } else {
+            String[] newLocalNames = new String[localNames.length + someLocalNames.length];
+            
+            System.arraycopy(localNames, 0, newLocalNames, 0, localNames.length);
+            System.arraycopy(someLocalNames, 0, newLocalNames, localNames.length, someLocalNames.length);
+            
+            IRubyObject[] newLocalValues = new IRubyObject[newLocalNames.length];
+            
+            System.arraycopy(localValues, 0, newLocalValues, 0, localValues.length);
+            Arrays.fill(newLocalValues, localValues.length, newLocalValues.length, rubyNil);
+            
+            this.localNames = newLocalNames;
+            this.localValues = newLocalValues;
         }
-        this.localNames.addAll(someLocalNames);
-        this.localValues.addAll(Collections.nCopies(someLocalNames.size(), rubyNil));
     }
 
     public boolean hasLocalVariables() {
         if (localNames == null) {
             return false;
         }
-        return ! localNames.isEmpty();
+        return localNames.length != 0;
     }
 
 	public IRubyObject getValue(int count) {
-	    return (IRubyObject)localValues.get(count);
+	    return localValues[count];
 	}
 
 	public void setValue(int count, IRubyObject value) {
-	    localValues.set(count, value);
+	    localValues[count] = value;
 	}
 
     /**
@@ -137,7 +154,7 @@
 
     public void setLastLine(IRubyObject value) {
         if (! hasLocalVariables()) {
-            resetLocalVariables(new ArrayList(Arrays.asList(SPECIAL_VARIABLE_NAMES)));
+            resetLocalVariables(SPECIAL_VARIABLE_NAMES);
         }
         setValue(LASTLINE_INDEX, value);
     }
@@ -151,7 +168,7 @@
 
     void setBackref(IRubyObject match) {
         if (! hasLocalVariables()) {
-            resetLocalVariables(new ArrayList(Arrays.asList(SPECIAL_VARIABLE_NAMES)));
+            resetLocalVariables(SPECIAL_VARIABLE_NAMES);
         }
         setValue(BACKREF_INDEX, match);
     }
Index: src/org/jruby/runtime/ThreadContext.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/runtime/ThreadContext.java,v
retrieving revision 1.44.2.7
diff -u -r1.44.2.7 ThreadContext.java
--- src/org/jruby/runtime/ThreadContext.java	23 Jan 2006 18:50:15 -0000	1.44.2.7
+++ src/org/jruby/runtime/ThreadContext.java	29 Jan 2006 14:54:18 -0000
@@ -34,7 +34,6 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
-import java.util.List;
 
 import org.jruby.IRuby;
 import org.jruby.IncludedModuleWrapper;
@@ -555,7 +554,7 @@
         pushRubyClass(runtime.getObject());
     }
 
-    public void preClassEval(List localNames, RubyModule type) {
+    public void preClassEval(String[] localNames, RubyModule type) {
         pushRubyClass(type); 
         pushFrameCopy();
         getCurrentFrame().newScope(localNames);
@@ -568,14 +567,14 @@
         popFrame();
     }
     
-    public void preScopedBody(List localNames) {
+    public void preScopedBody(String[] localNames) {
         getCurrentFrame().newScope(localNames);
     }
     
     public void postScopedBody() {
     }
     
-    public void preBsfApply(List localNames) {
+    public void preBsfApply(String[] localNames) {
         pushFrame();
         pushDynamicVars();
         getCurrentFrame().newScope(localNames);
