MCPcopy Create free account
hub / github.com/esengine/esengine / prewarm

Method prewarm

packages/core/src/Utils/Pool/Pool.ts:144–156  ·  view source on GitHub ↗

* 预填充池 * @param count 预填充的对象数量

(count: number)

Source from the content-addressed store, hash-verified

142 * @param count 预填充的对象数量
143 */
144 public prewarm(count: number): void {
145 const actualCount = Math.min(count, this._maxSize - this._objects.length);
146
147 for (let i = 0; i < actualCount; i++) {
148 const obj = this._createFn();
149 obj.reset();
150 this._objects.push(obj);
151 this._stats.totalCreated++;
152 this._stats.size++;
153 }
154
155 this._updateMemoryUsage();
156 }
157
158 /**
159 * 设置最大池大小

Callers 2

prewarmAllPoolsMethod · 0.45

Calls 4

_updateMemoryUsageMethod · 0.95
resetMethod · 0.65
pushMethod · 0.65
minMethod · 0.45

Tested by

no test coverage detected