Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize the performance of the memory pool. #8462

Merged
merged 1 commit into from Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions cocos/core/renderer/core/memory-pools.ts
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
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