@forgeax/engine-profiler 0.1.6 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.mjs +11 -9
- package/dist/index.mjs.map +1 -1
- package/dist/recorder.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/recorder.ts +14 -9
package/dist/recorder.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../src/recorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAiB,KAAK,cAAc,EAAc,MAAM,aAAa,CAAC;AAC7E,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EAEjB,gBAAgB,EAChB,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;CACjC;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE1D,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;AAEtF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAClD,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAC3D,UAAU,CAAC,MAAM,EAAE,aAAa,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AE,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACvE,QAAQ,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;IACjC,UAAU,CAAC,KAAK,EAAE,gBAAgB,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAC1D,QAAQ,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,IAAI,cAAc,CAAC,cAAc,CAAC,CAAC;CAC1C;AAoDD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAAC,IAAI,CAAC,CAKnF;AAgLD,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,YAAY,EACnB,YAAY,EAAE,oBAAoB,EAClC,gBAAgB,CAAC,EAAE;IAAE,8BAA8B,EAAE,MAAM,CAAA;CAAE,GAC5D,cAAc,CAAC,eAAe,CAAC,CAuJjC"}
|
package/package.json
CHANGED
package/src/recorder.ts
CHANGED
|
@@ -32,6 +32,10 @@ export interface RecorderSession {
|
|
|
32
32
|
|
|
33
33
|
const PHASE_RECORD_KIND = 1;
|
|
34
34
|
const SKIP_RECORD_KIND = 2;
|
|
35
|
+
// Keep the hot capture path out of repeated sparse-array growth while still
|
|
36
|
+
// bounding the up-front reservation for callers that choose a very large
|
|
37
|
+
// event limit. The recorder grows beyond this reserve on demand.
|
|
38
|
+
const INITIAL_RECORD_CAPACITY = 65_536;
|
|
35
39
|
|
|
36
40
|
interface RetainedRecordStore {
|
|
37
41
|
readonly kinds: number[];
|
|
@@ -266,6 +270,7 @@ export function createRecorder(
|
|
|
266
270
|
): ProfilerResult<RecorderSession> {
|
|
267
271
|
const validLimits = validateRecorderLimits(limits);
|
|
268
272
|
if (!validLimits.ok) return validLimits;
|
|
273
|
+
const initialRecordCapacity = Math.min(limits.eventLimit, INITIAL_RECORD_CAPACITY);
|
|
269
274
|
const state: RecorderState = {
|
|
270
275
|
limits,
|
|
271
276
|
phaseCatalog,
|
|
@@ -278,15 +283,15 @@ export function createRecorder(
|
|
|
278
283
|
render: new Set(phaseCatalog.render),
|
|
279
284
|
},
|
|
280
285
|
recordStore: {
|
|
281
|
-
kinds:
|
|
282
|
-
sources:
|
|
283
|
-
phases:
|
|
284
|
-
frameIds:
|
|
285
|
-
parentSources:
|
|
286
|
-
parentPhases:
|
|
287
|
-
startMicros:
|
|
288
|
-
endMicros:
|
|
289
|
-
reasons:
|
|
286
|
+
kinds: new Array(initialRecordCapacity),
|
|
287
|
+
sources: new Array(initialRecordCapacity),
|
|
288
|
+
phases: new Array(initialRecordCapacity),
|
|
289
|
+
frameIds: new Array(initialRecordCapacity),
|
|
290
|
+
parentSources: new Array(initialRecordCapacity),
|
|
291
|
+
parentPhases: new Array(initialRecordCapacity),
|
|
292
|
+
startMicros: new Array(initialRecordCapacity),
|
|
293
|
+
endMicros: new Array(initialRecordCapacity),
|
|
294
|
+
reasons: new Array(initialRecordCapacity),
|
|
290
295
|
count: 0,
|
|
291
296
|
},
|
|
292
297
|
captureId,
|