Skip to content

Commit f8519bb

Browse files
authored
Merge pull request yui#261 from pavelsher/master
speedup ScriptOrFnScope.munge
2 parents ae2ef30 + c4f87f5 commit f8519bb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/com/yahoo/platform/yui/compressor/ScriptOrFnScope.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
*/
99
package com.yahoo.platform.yui.compressor;
1010

11-
import java.util.ArrayList;
12-
import java.util.Enumeration;
13-
import java.util.Hashtable;
11+
import java.util.*;
1412

1513
class ScriptOrFnScope {
1614

@@ -124,7 +122,7 @@ void munge() {
124122
// Do not munge symbols in the global scope!
125123
if (parentScope != null) {
126124

127-
ArrayList freeSymbols = new ArrayList();
125+
LinkedHashSet freeSymbols = new LinkedHashSet();
128126

129127
freeSymbols.addAll(JavaScriptCompressor.ones);
130128
freeSymbols.removeAll(getAllUsedSymbols());
@@ -163,7 +161,9 @@ void munge() {
163161
String mungedValue;
164162
JavaScriptIdentifier identifier = (JavaScriptIdentifier) elements.nextElement();
165163
if (identifier.isMarkedForMunging()) {
166-
mungedValue = (String) freeSymbols.remove(0);
164+
Iterator freeSymIt = freeSymbols.iterator();
165+
mungedValue = (String) freeSymIt.next();
166+
freeSymIt.remove();
167167
} else {
168168
mungedValue = identifier.getValue();
169169
}

0 commit comments

Comments
 (0)