@threejs-doctor/bench 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 codergeeta
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,9 @@
1
+ import type { Profile } from '@threejs-doctor/core';
2
+ export interface LowEndBudget {
3
+ maxDrawCalls: number;
4
+ maxP95FrameTimeMs: number;
5
+ maxDpr: number;
6
+ minAvgFps: number;
7
+ }
8
+ export declare function getLowEndBudget(profile: Exclude<Profile, 'auto'>): LowEndBudget;
9
+ //# sourceMappingURL=budgets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"budgets.d.ts","sourceRoot":"","sources":["../src/budgets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAEnD,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,CAAA;IACpB,iBAAiB,EAAE,MAAM,CAAA;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB;AASD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,YAAY,CAM/E"}
@@ -0,0 +1,14 @@
1
+ const LOW = {
2
+ marketing: { maxDrawCalls: 60, maxP95FrameTimeMs: 22, maxDpr: 1, minAvgFps: 45 },
3
+ product: { maxDrawCalls: 80, maxP95FrameTimeMs: 24, maxDpr: 1, minAvgFps: 40 },
4
+ game: { maxDrawCalls: 100, maxP95FrameTimeMs: 28, maxDpr: 1, minAvgFps: 35 },
5
+ cad: { maxDrawCalls: 100, maxP95FrameTimeMs: 28, maxDpr: 1, minAvgFps: 35 },
6
+ };
7
+ export function getLowEndBudget(profile) {
8
+ const budget = LOW[profile];
9
+ if (!budget) {
10
+ throw new Error(`No low-end budget for profile: ${profile}`);
11
+ }
12
+ return budget;
13
+ }
14
+ //# sourceMappingURL=budgets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"budgets.js","sourceRoot":"","sources":["../src/budgets.ts"],"names":[],"mappings":"AASA,MAAM,GAAG,GAAmD;IAC1D,SAAS,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;IAChF,OAAO,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;IAC9E,IAAI,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,iBAAiB,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;IAC5E,GAAG,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,iBAAiB,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;CAC5E,CAAA;AAED,MAAM,UAAU,eAAe,CAAC,OAAiC;IAC/D,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,CAAA;IAC3B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,kCAAkC,OAAO,EAAE,CAAC,CAAA;IAC9D,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { DeviceCapabilities } from '@threejs-doctor/core';
2
+ import type { DoctorRendererLike, DoctorSceneLike } from '@threejs-doctor/runtime';
3
+ export declare function createCadFixture(): {
4
+ profile: "cad";
5
+ scene: DoctorSceneLike;
6
+ renderer: DoctorRendererLike;
7
+ camera: {};
8
+ device: DeviceCapabilities;
9
+ getSceneStats: () => {
10
+ textureCount: number;
11
+ estimatedVramBytes: number;
12
+ geometryCount: number;
13
+ lightCount: number;
14
+ shadowCastingLightCount: number;
15
+ };
16
+ };
17
+ //# sourceMappingURL=cad.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cad.d.ts","sourceRoot":"","sources":["../../src/fixtures/cad.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAElF,wBAAgB,gBAAgB;;;;;;;;;;;;;EA0C/B"}
@@ -0,0 +1,45 @@
1
+ export function createCadFixture() {
2
+ const lights = [{ castShadow: true }, { castShadow: true }, { castShadow: true }];
3
+ const renderer = {
4
+ info: { render: { calls: 180, triangles: 200_000 }, memory: { geometries: 120, textures: 15 } },
5
+ pixelRatio: 2,
6
+ antialias: true,
7
+ setPixelRatio(v) { this.pixelRatio = v; },
8
+ };
9
+ const scene = {
10
+ children: lights,
11
+ traverse(cb) {
12
+ for (const l of lights)
13
+ cb(l);
14
+ for (let i = 0; i < 80; i++) {
15
+ cb({
16
+ isMesh: true,
17
+ geometry: { uuid: `cad${i}` },
18
+ material: { uuid: `mat${i % 20}` },
19
+ matrixAutoUpdate: true,
20
+ visible: true,
21
+ position: { distanceTo: () => 15 },
22
+ });
23
+ }
24
+ },
25
+ };
26
+ const device = {
27
+ tier: 'mid', maxTextureSize: 8192, webgl: true, webgpu: false,
28
+ devicePixelRatio: 2, hardwareConcurrency: 8,
29
+ };
30
+ return {
31
+ profile: 'cad',
32
+ scene,
33
+ renderer,
34
+ camera: {},
35
+ device,
36
+ getSceneStats: () => ({
37
+ textureCount: 15,
38
+ estimatedVramBytes: 80_000_000,
39
+ geometryCount: 120,
40
+ lightCount: lights.length,
41
+ shadowCastingLightCount: lights.filter((l) => l.castShadow).length,
42
+ }),
43
+ };
44
+ }
45
+ //# sourceMappingURL=cad.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cad.js","sourceRoot":"","sources":["../../src/fixtures/cad.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,gBAAgB;IAC9B,MAAM,MAAM,GAAG,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;IACjF,MAAM,QAAQ,GAAuB;QACnC,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE;QAC/F,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,IAAI;QACf,aAAa,CAAC,CAAS,IAAI,IAAI,CAAC,UAAU,GAAG,CAAC,CAAA,CAAC,CAAC;KACjD,CAAA;IACD,MAAM,KAAK,GAAoB;QAC7B,QAAQ,EAAE,MAAM;QAChB,QAAQ,CAAC,EAAE;YACT,KAAK,MAAM,CAAC,IAAI,MAAM;gBAAE,EAAE,CAAC,CAAU,CAAC,CAAA;YACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC5B,EAAE,CAAC;oBACD,MAAM,EAAE,IAAI;oBACZ,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE;oBAC7B,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,EAAE,EAAE,EAAE;oBAClC,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE,IAAI;oBACb,QAAQ,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE;iBACnC,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;KACF,CAAA;IACD,MAAM,MAAM,GAAuB;QACjC,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK;QAC7D,gBAAgB,EAAE,CAAC,EAAE,mBAAmB,EAAE,CAAC;KAC5C,CAAA;IACD,OAAO;QACL,OAAO,EAAE,KAAc;QACvB,KAAK;QACL,QAAQ;QACR,MAAM,EAAE,EAAE;QACV,MAAM;QACN,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;YACpB,YAAY,EAAE,EAAE;YAChB,kBAAkB,EAAE,UAAU;YAC9B,aAAa,EAAE,GAAG;YAClB,UAAU,EAAE,MAAM,CAAC,MAAM;YACzB,uBAAuB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM;SACnE,CAAC;KACH,CAAA;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { DeviceCapabilities } from '@threejs-doctor/core';
2
+ import type { DoctorRendererLike, DoctorSceneLike } from '@threejs-doctor/runtime';
3
+ export declare function createGameFixture(): {
4
+ profile: "game";
5
+ scene: DoctorSceneLike;
6
+ renderer: DoctorRendererLike;
7
+ camera: {};
8
+ device: DeviceCapabilities;
9
+ getSceneStats: () => {
10
+ textureCount: number;
11
+ estimatedVramBytes: number;
12
+ geometryCount: number;
13
+ lightCount: number;
14
+ shadowCastingLightCount: number;
15
+ };
16
+ };
17
+ //# sourceMappingURL=game.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"game.d.ts","sourceRoot":"","sources":["../../src/fixtures/game.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAElF,wBAAgB,iBAAiB;;;;;;;;;;;;;EA6ChC"}
@@ -0,0 +1,48 @@
1
+ export function createGameFixture() {
2
+ const lights = [
3
+ { castShadow: true }, { castShadow: true },
4
+ { castShadow: true }, { castShadow: true },
5
+ ];
6
+ const renderer = {
7
+ info: { render: { calls: 160, triangles: 80_000 }, memory: { geometries: 60, textures: 20 } },
8
+ pixelRatio: 2,
9
+ antialias: false,
10
+ setPixelRatio(v) { this.pixelRatio = v; },
11
+ };
12
+ const scene = {
13
+ children: lights,
14
+ traverse(cb) {
15
+ for (const l of lights)
16
+ cb(l);
17
+ for (let i = 0; i < 40; i++) {
18
+ cb({
19
+ isMesh: true,
20
+ geometry: { uuid: `g${i}` },
21
+ material: { uuid: 'shared' },
22
+ matrixAutoUpdate: true,
23
+ visible: true,
24
+ position: { distanceTo: () => (i > 30 ? 120 : 20) },
25
+ });
26
+ }
27
+ },
28
+ };
29
+ const device = {
30
+ tier: 'mid', maxTextureSize: 8192, webgl: true, webgpu: false,
31
+ devicePixelRatio: 2, hardwareConcurrency: 8,
32
+ };
33
+ return {
34
+ profile: 'game',
35
+ scene,
36
+ renderer,
37
+ camera: {},
38
+ device,
39
+ getSceneStats: () => ({
40
+ textureCount: 20,
41
+ estimatedVramBytes: 96_000_000,
42
+ geometryCount: 60,
43
+ lightCount: lights.length,
44
+ shadowCastingLightCount: lights.filter((l) => l.castShadow).length,
45
+ }),
46
+ };
47
+ }
48
+ //# sourceMappingURL=game.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"game.js","sourceRoot":"","sources":["../../src/fixtures/game.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,iBAAiB;IAC/B,MAAM,MAAM,GAAG;QACb,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;QAC1C,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;KAC3C,CAAA;IACD,MAAM,QAAQ,GAAuB;QACnC,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE;QAC7F,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,KAAK;QAChB,aAAa,CAAC,CAAS,IAAI,IAAI,CAAC,UAAU,GAAG,CAAC,CAAA,CAAC,CAAC;KACjD,CAAA;IACD,MAAM,KAAK,GAAoB;QAC7B,QAAQ,EAAE,MAAM;QAChB,QAAQ,CAAC,EAAE;YACT,KAAK,MAAM,CAAC,IAAI,MAAM;gBAAE,EAAE,CAAC,CAAU,CAAC,CAAA;YACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC5B,EAAE,CAAC;oBACD,MAAM,EAAE,IAAI;oBACZ,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;oBAC3B,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC5B,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE,IAAI;oBACb,QAAQ,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;iBACpD,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;KACF,CAAA;IACD,MAAM,MAAM,GAAuB;QACjC,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK;QAC7D,gBAAgB,EAAE,CAAC,EAAE,mBAAmB,EAAE,CAAC;KAC5C,CAAA;IACD,OAAO;QACL,OAAO,EAAE,MAAe;QACxB,KAAK;QACL,QAAQ;QACR,MAAM,EAAE,EAAE;QACV,MAAM;QACN,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;YACpB,YAAY,EAAE,EAAE;YAChB,kBAAkB,EAAE,UAAU;YAC9B,aAAa,EAAE,EAAE;YACjB,UAAU,EAAE,MAAM,CAAC,MAAM;YACzB,uBAAuB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM;SACnE,CAAC;KACH,CAAA;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { DeviceCapabilities } from '@threejs-doctor/core';
2
+ import type { DoctorRendererLike, DoctorSceneLike } from '@threejs-doctor/runtime';
3
+ export declare function createMarketingFixture(): {
4
+ profile: "marketing";
5
+ scene: DoctorSceneLike;
6
+ renderer: DoctorRendererLike;
7
+ camera: {};
8
+ device: DeviceCapabilities;
9
+ getSceneStats: () => {
10
+ textureCount: number;
11
+ estimatedVramBytes: number;
12
+ geometryCount: number;
13
+ lightCount: number;
14
+ shadowCastingLightCount: number;
15
+ };
16
+ };
17
+ //# sourceMappingURL=marketing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marketing.d.ts","sourceRoot":"","sources":["../../src/fixtures/marketing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAElF,wBAAgB,sBAAsB;;;;;;;;;;;;;EAwCrC"}
@@ -0,0 +1,43 @@
1
+ export function createMarketingFixture() {
2
+ const lights = [{ castShadow: true }, { castShadow: true }];
3
+ const renderer = {
4
+ info: { render: { calls: 90, triangles: 12_000 }, memory: { geometries: 12, textures: 6 } },
5
+ pixelRatio: 3,
6
+ antialias: true,
7
+ setPixelRatio(v) { this.pixelRatio = v; },
8
+ };
9
+ const scene = {
10
+ children: lights,
11
+ traverse(cb) {
12
+ for (const l of lights)
13
+ cb(l);
14
+ cb({
15
+ isMesh: true,
16
+ geometry: { uuid: 'm1' },
17
+ material: { uuid: 'mat1' },
18
+ matrixAutoUpdate: true,
19
+ visible: true,
20
+ position: { distanceTo: () => 10 },
21
+ });
22
+ },
23
+ };
24
+ const device = {
25
+ tier: 'low', maxTextureSize: 4096, webgl: true, webgpu: false,
26
+ devicePixelRatio: 3, hardwareConcurrency: 4,
27
+ };
28
+ return {
29
+ profile: 'marketing',
30
+ scene,
31
+ renderer,
32
+ camera: {},
33
+ device,
34
+ getSceneStats: () => ({
35
+ textureCount: 6,
36
+ estimatedVramBytes: 24_000_000,
37
+ geometryCount: 12,
38
+ lightCount: lights.length,
39
+ shadowCastingLightCount: lights.filter((l) => l.castShadow).length,
40
+ }),
41
+ };
42
+ }
43
+ //# sourceMappingURL=marketing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marketing.js","sourceRoot":"","sources":["../../src/fixtures/marketing.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,sBAAsB;IACpC,MAAM,MAAM,GAAG,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;IAC3D,MAAM,QAAQ,GAAuB;QACnC,IAAI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,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM;SACnE,CAAC;KACH,CAAA;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { DeviceCapabilities } from '@threejs-doctor/core';
2
+ import type { DoctorRendererLike, DoctorSceneLike } from '@threejs-doctor/runtime';
3
+ export declare function createProductFixture(): {
4
+ profile: "product";
5
+ scene: DoctorSceneLike;
6
+ renderer: DoctorRendererLike;
7
+ camera: {};
8
+ device: DeviceCapabilities;
9
+ getSceneStats: () => {
10
+ textureCount: number;
11
+ estimatedVramBytes: number;
12
+ geometryCount: number;
13
+ lightCount: number;
14
+ shadowCastingLightCount: number;
15
+ };
16
+ };
17
+ //# sourceMappingURL=product.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../../src/fixtures/product.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAElF,wBAAgB,oBAAoB;;;;;;;;;;;;;EAwCnC"}
@@ -0,0 +1,43 @@
1
+ export function createProductFixture() {
2
+ const lights = [{ castShadow: true }, { castShadow: true }, { castShadow: true }];
3
+ const renderer = {
4
+ info: { render: { calls: 110, triangles: 30_000 }, memory: { geometries: 8, textures: 10 } },
5
+ pixelRatio: 2.5,
6
+ antialias: true,
7
+ setPixelRatio(v) { this.pixelRatio = v; },
8
+ };
9
+ const scene = {
10
+ children: lights,
11
+ traverse(cb) {
12
+ for (const l of lights)
13
+ cb(l);
14
+ cb({
15
+ isMesh: true,
16
+ geometry: { uuid: 'p1' },
17
+ material: { uuid: 'pmat' },
18
+ matrixAutoUpdate: true,
19
+ visible: true,
20
+ position: { distanceTo: () => 5 },
21
+ });
22
+ },
23
+ };
24
+ const device = {
25
+ tier: 'low', maxTextureSize: 4096, webgl: true, webgpu: false,
26
+ devicePixelRatio: 2.5, hardwareConcurrency: 4,
27
+ };
28
+ return {
29
+ profile: 'product',
30
+ scene,
31
+ renderer,
32
+ camera: {},
33
+ device,
34
+ getSceneStats: () => ({
35
+ textureCount: 10,
36
+ estimatedVramBytes: 48_000_000,
37
+ geometryCount: 8,
38
+ lightCount: lights.length,
39
+ shadowCastingLightCount: lights.filter((l) => l.castShadow).length,
40
+ }),
41
+ };
42
+ }
43
+ //# sourceMappingURL=product.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.js","sourceRoot":"","sources":["../../src/fixtures/product.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,oBAAoB;IAClC,MAAM,MAAM,GAAG,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;IACjF,MAAM,QAAQ,GAAuB;QACnC,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE;QAC5F,UAAU,EAAE,GAAG;QACf,SAAS,EAAE,IAAI;QACf,aAAa,CAAC,CAAS,IAAI,IAAI,CAAC,UAAU,GAAG,CAAC,CAAA,CAAC,CAAC;KACjD,CAAA;IACD,MAAM,KAAK,GAAoB;QAC7B,QAAQ,EAAE,MAAM;QAChB,QAAQ,CAAC,EAAE;YACT,KAAK,MAAM,CAAC,IAAI,MAAM;gBAAE,EAAE,CAAC,CAAU,CAAC,CAAA;YACtC,EAAE,CAAC;gBACD,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;gBACxB,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;gBAC1B,gBAAgB,EAAE,IAAI;gBACtB,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE;aAClC,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;IACD,MAAM,MAAM,GAAuB;QACjC,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK;QAC7D,gBAAgB,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC;KAC9C,CAAA;IACD,OAAO;QACL,OAAO,EAAE,SAAkB;QAC3B,KAAK;QACL,QAAQ;QACR,MAAM,EAAE,EAAE;QACV,MAAM;QACN,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;YACpB,YAAY,EAAE,EAAE;YAChB,kBAAkB,EAAE,UAAU;YAC9B,aAAa,EAAE,CAAC;YAChB,UAAU,EAAE,MAAM,CAAC,MAAM;YACzB,uBAAuB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM;SACnE,CAAC;KACH,CAAA;AACH,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { type DoctorReport, type DoctorRendererLike, type DoctorSceneLike } from '@threejs-doctor/runtime';
2
+ import type { DeviceCapabilities, Profile, SceneStatsLike } from '@threejs-doctor/core';
3
+ export interface FixtureCreateResult {
4
+ profile: Exclude<Profile, 'auto'>;
5
+ scene: DoctorSceneLike;
6
+ renderer: DoctorRendererLike;
7
+ camera: unknown;
8
+ device: DeviceCapabilities;
9
+ getSceneStats: () => SceneStatsLike;
10
+ }
11
+ /** Headless mock scenes: no WebGL/GPU. CI and unit tests run these without a renderer. */
12
+ export declare const fixtures: Record<Exclude<Profile, 'auto'>, {
13
+ profile: Exclude<Profile, 'auto'>;
14
+ create: () => FixtureCreateResult;
15
+ }>;
16
+ export declare function runBenchSuite(opts: {
17
+ profile: Exclude<Profile, 'auto'>;
18
+ budget: 'low' | 'mid' | 'high';
19
+ }): Promise<DoctorReport>;
20
+ export declare function runAllBenchSuites(): Promise<Record<Exclude<Profile, 'auto'>, DoctorReport>>;
21
+ //# sourceMappingURL=harness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../src/harness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAClH,OAAO,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAOvF,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IACjC,KAAK,EAAE,eAAe,CAAA;IACtB,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,kBAAkB,CAAA;IAC1B,aAAa,EAAE,MAAM,cAAc,CAAA;CACpC;AAED,0FAA0F;AAC1F,eAAO,MAAM,QAAQ,EAAE,MAAM,CAC3B,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,EACxB;IAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,mBAAmB,CAAA;CAAE,CAMzE,CAAA;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IACjC,MAAM,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAA;CAC/B,GAAG,OAAO,CAAC,YAAY,CAAC,CA0BxB;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAChD,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,YAAY,CAAC,CAC/C,CAOA"}
@@ -0,0 +1,49 @@
1
+ import { Doctor } from '@threejs-doctor/runtime';
2
+ import { createMarketingFixture } from './fixtures/marketing.js';
3
+ import { createProductFixture } from './fixtures/product.js';
4
+ import { createGameFixture } from './fixtures/game.js';
5
+ import { createCadFixture } from './fixtures/cad.js';
6
+ import { getLowEndBudget } from './budgets.js';
7
+ /** Headless mock scenes: no WebGL/GPU. CI and unit tests run these without a renderer. */
8
+ export const fixtures = {
9
+ marketing: { profile: 'marketing', create: createMarketingFixture },
10
+ product: { profile: 'product', create: createProductFixture },
11
+ game: { profile: 'game', create: createGameFixture },
12
+ cad: { profile: 'cad', create: createCadFixture },
13
+ };
14
+ export async function runBenchSuite(opts) {
15
+ const entry = fixtures[opts.profile];
16
+ if (!entry) {
17
+ throw new Error(`No bench fixture for profile: ${opts.profile}`);
18
+ }
19
+ const fixture = entry.create();
20
+ let t = 0;
21
+ const doctor = new Doctor({
22
+ scene: fixture.scene,
23
+ camera: fixture.camera,
24
+ renderer: fixture.renderer,
25
+ profile: opts.profile,
26
+ mode: 'benchmark',
27
+ measureFrames: 8,
28
+ device: fixture.device,
29
+ getSceneStats: fixture.getSceneStats,
30
+ now: () => {
31
+ t += 16;
32
+ return t;
33
+ },
34
+ });
35
+ await doctor.measure();
36
+ const report = await doctor.optimize({ apply: ['safe'] });
37
+ // v1 only defines low-end budgets; mid/high still exercise the same mock loop.
38
+ void getLowEndBudget(opts.profile);
39
+ return { ...report, mode: 'benchmark' };
40
+ }
41
+ export async function runAllBenchSuites() {
42
+ const profiles = ['marketing', 'product', 'game', 'cad'];
43
+ const out = {};
44
+ for (const profile of profiles) {
45
+ out[profile] = await runBenchSuite({ profile, budget: 'low' });
46
+ }
47
+ return out;
48
+ }
49
+ //# sourceMappingURL=harness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness.js","sourceRoot":"","sources":["../src/harness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAoE,MAAM,yBAAyB,CAAA;AAElH,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,oBA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I,EAAE,CAAA;YACP,OAAO,CAAC,CAAA;QACV,CAAC;KACF,CAAC,CAAA;IACF,MAAM,MAAM,CAAC,OAAO,EAAE,CAAA;IACtB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IACzD,+EAA+E;IAC/E,KAAK,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAClC,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,CAAA;AACzC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB;IAGrC,MAAM,QAAQ,GAAG,CAAC,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAU,CAAA;IACjE,MAAM,GAAG,GAAG,EAAoD,CAAA;IAChE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,GAAG,CAAC,OAAO,CAAC,GAAG,MAAM,aAAa,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;IAChE,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const PACKAGE_NAME: "@threejs-doctor/bench";
2
+ export * from './budgets.js';
3
+ export * from './harness.js';
4
+ export { createMarketingFixture } from './fixtures/marketing.js';
5
+ export { createProductFixture } from './fixtures/product.js';
6
+ export { createGameFixture } from './fixtures/game.js';
7
+ export { createCadFixture } from './fixtures/cad.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,EAAG,uBAAgC,CAAA;AAC5D,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ export const PACKAGE_NAME = '@threejs-doctor/bench';
2
+ export * from './budgets.js';
3
+ export * from './harness.js';
4
+ export { createMarketingFixture } from './fixtures/marketing.js';
5
+ export { createProductFixture } from './fixtures/product.js';
6
+ export { createGameFixture } from './fixtures/game.js';
7
+ export { createCadFixture } from './fixtures/cad.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,uBAAgC,CAAA;AAC5D,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@threejs-doctor/bench",
3
+ "version": "0.1.0",
4
+ "description": "Headless bench fixtures and low-end budgets for threejs-doctor",
5
+ "license": "MIT",
6
+ "author": "codergeeta",
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "dependencies": {
20
+ "@threejs-doctor/runtime": "^0.1.0",
21
+ "@threejs-doctor/core": "^0.1.0"
22
+ },
23
+ "peerDependencies": {
24
+ "three": ">=0.160.0"
25
+ },
26
+ "devDependencies": {
27
+ "three": "^0.172.0",
28
+ "@types/three": "^0.172.0",
29
+ "typescript": "^5.7.3",
30
+ "vitest": "^3.0.5"
31
+ },
32
+ "engines": {
33
+ "node": ">=20"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/codergeeta/threejs-doctor.git",
38
+ "directory": "packages/bench"
39
+ },
40
+ "homepage": "https://github.com/codergeeta/threejs-doctor#readme",
41
+ "bugs": {
42
+ "url": "https://github.com/codergeeta/threejs-doctor/issues"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "scripts": {
48
+ "build": "tsc -p tsconfig.json",
49
+ "test": "vitest run",
50
+ "typecheck": "tsc -p tsconfig.json --noEmit"
51
+ }
52
+ }