add initial sparse set size to constructor (default value is 1024)
This commit is contained in:
parent
2e417fcf81
commit
f4d89016bb
|
|
@ -15,6 +15,10 @@ export class SparseSet<V> {
|
||||||
private dense: number[] = [];
|
private dense: number[] = [];
|
||||||
private data: V[] = [];
|
private data: V[] = [];
|
||||||
|
|
||||||
|
constructor(initialSize: number = 1024) {
|
||||||
|
this.growSparse(initialSize);
|
||||||
|
}
|
||||||
|
|
||||||
private growSparse(minId: number): void {
|
private growSparse(minId: number): void {
|
||||||
if (minId < this.sparse.length) return;
|
if (minId < this.sparse.length) return;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue