Performance update to remove several very high counts of temp object creation

This commit is contained in:
Tahg
2011-12-06 08:52:45 -05:00
parent eead44a692
commit bc8f02788f
11 changed files with 223 additions and 141 deletions

View File

@@ -125,6 +125,31 @@ public class LongHashset extends LongHash {
return 0;
}
public long[] popAll() {
int index = 0;
rl.lock();
try {
long[] ret = new long[this.count];
for (long[][] outer: this.values) {
if (outer == null) continue;
for (int oIdx = outer.length - 1; oIdx >= 0; oIdx--) {
long[] inner = outer[oIdx];
if (inner == null) continue;
for (long entry: inner) {
ret[index++] = entry;
}
outer[oIdx] = null;
}
}
count = 0;
return ret;
} finally {
rl.unlock();
}
}
public long[] keys() {
int index = 0;
rl.lock();