Skip to content

Commit

Permalink
Optimize the performance of the memory pool. (#8456)
Browse files Browse the repository at this point in the history
  • Loading branch information
caryliu1999 committed Apr 16, 2021
1 parent c524cda commit 7f64e64
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions cocos/core/renderer/core/memory-pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ export class ObjectPool<T, P extends PoolType, A extends any[]> implements IMemo
if (!obj) { return 0 as unknown as IHandle<P>; }
this._array.push(obj);
}
if (JSB) this._nativePool.bind(i, this._array[i] as T);
return i + this._poolFlag as unknown as IHandle<P>; // guarantees the handle is always not zero
}

Expand Down
1 change: 1 addition & 0 deletions cocos/core/renderer/core/native-pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class NativeBufferPool {

export class NativeObjectPool<T> {
constructor (dataType: number, array: T[]) {}
public bind (index: number, obj: T) {}
}

export class NativeBufferAllocator {
Expand Down

0 comments on commit 7f64e64

Please sign in to comment.