Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(sdk): the benchmarks have not run since the ECS moved

esengine8fd8d4f1d839
diff --git a/sdk/benchmarks/commands.bench.ts b/sdk/benchmarks/commands.bench.ts
index b5d69570f..0f4337b3f 100644
--- a/sdk/benchmarks/commands.bench.ts
+++ b/sdk/benchmarks/commands.bench.ts
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { bench, describe } from 'vitest';
-import { World } from '../src/world';
-import { defineComponent } from '../src/component';
-import { CommandsInstance } from '../src/commands';
-import { ResourceStorage } from '../src/resource';
+import { World } from '../src/ecs/world';
+import { defineComponent } from '../src/ecs/component';
+import { CommandsInstance } from '../src/ecs/commands';
+import { ResourceStorage } from '../src/ecs/resource';
import { Entity } from '../src/types';
const Position = defineComponent('CmdBenchPosition', { x: 0, y: 0 });
diff --git a/sdk/benchmarks/component.bench.ts b/sdk/benchmarks/component.bench.ts
index 26117280d..c1558e185 100644
--- a/sdk/benchmarks/component.bench.ts
+++ b/sdk/benchmarks/component.bench.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { bench, describe } from 'vitest';
-import { defineComponent, getComponent, getComponentRegistry, clearUserComponents } from '../src/component';
-import { computeQueryCacheKey } from '../src/world';
+import { defineComponent, getComponent, getComponentRegistry, clearUserComponents } from '../src/ecs/component';
+import { computeQueryCacheKey } from '../src/ecs/world';
describe('Component - Definition', () => {
bench('defineComponent (simple)', () => {
diff --git a/sdk/benchmarks/event.bench.ts b/sdk/benchmarks/event.bench.ts
index 29922088a..7f06f987a 100644
--- a/sdk/benchmarks/event.bench.ts
+++ b/sdk/benchmarks/event.bench.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { bench, describe } from 'vitest';
-import { defineEvent, EventBus, EventRegistry, EventWriterInstance, EventReaderInstance } from '../src/event';
+import { defineEvent, EventBus, EventRegistry, EventWriterInstance, EventReaderInstance } from '../src/ecs/event';
interface DamageEvent {
target: number;
diff --git a/sdk/benchmarks/physics.bench.ts b/sdk/benchmarks/physics.bench.ts
index 069d2c7e4..411eb3046 100644
--- a/sdk/benchmarks/physics.bench.ts
+++ b/sdk/benchmarks/physics.bench.ts
@@ -2,17 +2,21 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, bench, beforeAll } from 'vitest';
import path from 'path';
-import { World } from '../src/world';
-import { defineBuiltin } from '../src/component';
+import { World } from '../src/ecs/world';
+import { defineBuiltin } from '../src/ecs/component';
import type { CppRegistry, ESEngineModule } from '../src/wasm';
import type { PhysicsWasmModule } from '../src/physics/PhysicsModuleLoader';
import { syncDynamicTransforms } from '../src/physics/PhysicsSystem';
import type { Entity } from '../src/types';
+import { WASM_DIR as WASM_DIR_SHARED } from '../tests/helpers/loadWasm';
let wasmModule: ESEngineModule;
let physicsMod: PhysicsWasmModule;
-const WASM_DIR = path.resolve(__dirname, '../../desktop/public/wasm');
+// Same resolution the integration tests use: $ESENGINE_WASM_DIR, then the
+// in-repo build output, then the editor's copy. Hard-coding the last of
+// those is why these never found a wasm in CI.
+const WASM_DIR = WASM_DIR_SHARED;
beforeAll(async () => {
const engineJs = path.join(WASM_DIR, 'esengine.js');
diff --git a/sdk/benchmarks/query-cache-miss.bench.ts b/sdk/benchmarks/query-cache-miss.bench.ts
index 6582c1f0b..056124f8f 100644
--- a/sdk/benchmarks/query-cache-miss.bench.ts
+++ b/sdk/benchmarks/query-cache-miss.bench.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, bench } from 'vitest';
-import { World } from '../src/world';
-import { defineComponent } from '../src/component';
+import { World } from '../src/ecs/world';
+import { defineComponent } from '../src/ecs/component';
const A = defineComponent('CMA', { v: 0 });
const B = defineComponent('CMB', { v: 0 });
diff --git a/sdk/benchmarks/query-mut-writeback.bench.ts b/sdk/benchmarks/query-mut-writeback.bench.ts
index b0c7d695a..ccd17ef95 100644
--- a/sdk/benchmarks/query-mut-writeback.bench.ts
+++ b/sdk/benchmarks/query-mut-writeback.bench.ts
@@ -11,9 +11,9 @@
* Map.set that only runs when someone is actually listening) is small.
*/
import { bench, describe } from 'vitest';
-import { World } from '../src/world';
-import { Query, QueryInstance, Mut } from '../src/query';
-import { Transform, type TransformData } from '../src/component';
+import { World } from '../src/ecs/world';
+import { Query, QueryInstance, Mut } from '../src/ecs/query';
+import { Transform, type TransformData } from '../src/ecs/component';
import { createMockModule } from '../tests/mocks/wasm';
const N = 5000;
diff --git a/sdk/benchmarks/query.bench.ts b/sdk/benchmarks/query.bench.ts
index 689d93718..1beb0a1aa 100644
--- a/sdk/benchmarks/query.bench.ts
+++ b/sdk/benchmarks/query.bench.ts
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { bench, describe } from 'vitest';
-import { World } from '../src/world';
-import { defineComponent } from '../src/component';
-import { QueryInstance, Query, Mut } from '../src/query';
+import { World } from '../src/ecs/world';
+import { defineComponent } from '../src/ecs/component';
+import { QueryInstance, Query, Mut } from '../src/ecs/query';
import { Entity } from '../src/types';
const Position = defineComponent('QBenchPosition', { x: 0, y: 0 });
diff --git a/sdk/benchmarks/spine.bench.ts b/sdk/benchmarks/spine.bench.ts
index c6856f637..a37ff9fda 100644
--- a/sdk/benchmarks/spine.bench.ts
+++ b/sdk/benchmarks/spine.bench.ts
@@ -7,8 +7,12 @@ import { wrapSpineModule } from '../src/spine/SpineModuleLoader';
import type { SpineWasmModule, SpineWrappedAPI } from '../src/spine/SpineModuleLoader';
import { SpineModuleController } from '../src/spine/SpineController';
import type { ESEngineModule } from '../src/wasm';
+import { WASM_DIR as WASM_DIR_SHARED } from '../tests/helpers/loadWasm';
-const WASM_DIR = path.resolve(__dirname, '../../desktop/public/wasm');
+// Same resolution the integration tests use: $ESENGINE_WASM_DIR, then the
+// in-repo build output, then the editor's copy. Hard-coding the last of
+// those is why these never found a wasm in CI.
+const WASM_DIR = WASM_DIR_SHARED;
const SPINE_ASSETS = path.resolve(__dirname, 'fixtures/spine');
let raw: SpineWasmModule;
diff --git a/sdk/benchmarks/system.bench.ts b/sdk/benchmarks/system.bench.ts
index 525ba9e97..9f0cd97d5 100644
--- a/sdk/benchmarks/system.bench.ts
+++ b/sdk/benchmarks/system.bench.ts
@@ -1,15 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, bench } from 'vitest';
-import { World } from '../src/world';
-import { defineComponent } from '../src/component';
-import { defineSystem, SystemRunner, Schedule } from '../src/system';
-import { ResourceStorage } from '../src/resource';
-import { EventRegistry } from '../src/event';
-import { Query, Mut } from '../src/query';
-import { Commands } from '../src/commands';
-import { Res, defineResource, ResMut } from '../src/resource';
-import { EventWriter, EventReader, defineEvent } from '../src/event';
+import { World } from '../src/ecs/world';
+import { defineComponent } from '../src/ecs/component';
+import { defineSystem, SystemRunner, Schedule } from '../src/ecs/system';
+import { ResourceStorage } from '../src/ecs/resource';
+import { EventRegistry } from '../src/ecs/event';
+import { Query, Mut } from '../src/ecs/query';
+import { Commands } from '../src/ecs/commands';
+import { Res, defineResource, ResMut } from '../src/ecs/resource';
+import { EventWriter, EventReader, defineEvent } from '../src/ecs/event';
const Position = defineComponent('BenchSysPos', { x: 0, y: 0 });
const Velocity = defineComponent('BenchSysVel', { dx: 0, dy: 0 });
diff --git a/sdk/benchmarks/ui-layout.bench.ts b/sdk/benchmarks/ui-layout.bench.ts
index 87023ac84..0880f28be 100644
--- a/sdk/benchmarks/ui-layout.bench.ts
+++ b/sdk/benchmarks/ui-layout.bench.ts
@@ -19,10 +19,14 @@
import { describe, bench, beforeAll } from 'vitest';
import path from 'path';
import type { ESEngineModule, Registry, Entity } from '../src/wasm/wasm.generated';
+import { WASM_DIR as WASM_DIR_SHARED } from '../tests/helpers/loadWasm';
let wasm: ESEngineModule;
-const WASM_DIR = path.resolve(__dirname, '../../desktop/public/wasm');
+// Same resolution the integration tests use: $ESENGINE_WASM_DIR, then the
+// in-repo build output, then the editor's copy. Hard-coding the last of
+// those is why these never found a wasm in CI.
+const WASM_DIR = WASM_DIR_SHARED;
beforeAll(async () => {
const engineMod = await import(path.join(WASM_DIR, 'esengine.js'));
diff --git a/sdk/benchmarks/uiMath.bench.ts b/sdk/benchmarks/uiMath.bench.ts
index 35eed93d7..e6ef3d96d 100644
--- a/sdk/benchmarks/uiMath.bench.ts
+++ b/sdk/benchmarks/uiMath.bench.ts
@@ -9,7 +9,7 @@ import {
pointInOBB,
intersectRects,
createInvVPCache,
-} from '../src/ui/uiMath';
+} from '../src/ui/util/math';
const identityMatrix = new Float32Array([
1, 0, 0, 0,
diff --git a/sdk/benchmarks/wasm-boundary.bench.ts b/sdk/benchmarks/wasm-boundary.bench.ts
index 3298c1852..849aefdec 100644
--- a/sdk/benchmarks/wasm-boundary.bench.ts
+++ b/sdk/benchmarks/wasm-boundary.bench.ts
@@ -3,14 +3,18 @@
import { describe, bench, beforeAll } from 'vitest';
import path from 'path';
import { fileURLToPath } from 'url';
-import { Transform, Sprite } from '../src/component';
+import { Transform, Sprite } from '../src/ecs/component';
import { UINode } from '../src/ui/core/ui-node';
-import { convertForWasm } from '../src/ecs/BuiltinBridge';
+import { convertForWasm } from '../src/ecs/bridge/BuiltinBridge';
+import { WASM_DIR as WASM_DIR_SHARED } from '../tests/helpers/loadWasm';
let module: any;
let Registry: any;
-const WASM_DIR = path.resolve(__dirname, '../../desktop/public/wasm');
+// Same resolution the integration tests use: $ESENGINE_WASM_DIR, then the
+// in-repo build output, then the editor's copy. Hard-coding the last of
+// those is why these never found a wasm in CI.
+const WASM_DIR = WASM_DIR_SHARED;
// Build the embind value_object payloads from the authoritative component
// defaults (the same source BuiltinBridge inserts from), so these stay valid as
diff --git a/sdk/benchmarks/wasm-vs-world.bench.ts b/sdk/benchmarks/wasm-vs-world.bench.ts
index 53dc9055a..320d34782 100644
--- a/sdk/benchmarks/wasm-vs-world.bench.ts
+++ b/sdk/benchmarks/wasm-vs-world.bench.ts
@@ -2,13 +2,17 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, bench, beforeAll } from 'vitest';
import path from 'path';
-import { World } from '../src/world';
-import { defineBuiltin } from '../src/component';
+import { World } from '../src/ecs/world';
+import { defineBuiltin } from '../src/ecs/component';
import type { CppRegistry, ESEngineModule } from '../src/wasm';
+import { WASM_DIR as WASM_DIR_SHARED } from '../tests/helpers/loadWasm';
let wasmModule: ESEngineModule;
-const WASM_DIR = path.resolve(__dirname, '../../desktop/public/wasm');
+// Same resolution the integration tests use: $ESENGINE_WASM_DIR, then the
+// in-repo build output, then the editor's copy. Hard-coding the last of
+// those is why these never found a wasm in CI.
+const WASM_DIR = WASM_DIR_SHARED;
beforeAll(async () => {
const jsPath = path.join(WASM_DIR, 'esengine.js');
diff --git a/sdk/benchmarks/world-internals.bench.ts b/sdk/benchmarks/world-internals.bench.ts
index 948364ca5..d318c32c1 100644
--- a/sdk/benchmarks/world-internals.bench.ts
+++ b/sdk/benchmarks/world-internals.bench.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, bench } from 'vitest';
-import { World } from '../src/world';
-import { defineComponent } from '../src/component';
+import { World } from '../src/ecs/world';
+import { defineComponent } from '../src/ecs/component';
const Position = defineComponent('BenchWIPos', { x: 0, y: 0 });
const Velocity = defineComponent('BenchWIVel', { dx: 0, dy: 0 });
diff --git a/sdk/benchmarks/world.bench.ts b/sdk/benchmarks/world.bench.ts
index 54a6658d6..0f6245f02 100644
--- a/sdk/benchmarks/world.bench.ts
+++ b/sdk/benchmarks/world.bench.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { bench, describe } from 'vitest';
-import { World } from '../src/world';
-import { defineComponent } from '../src/component';
+import { World } from '../src/ecs/world';
+import { defineComponent } from '../src/ecs/component';
import { Entity } from '../src/types';
const Position = defineComponent('BenchPosition', { x: 0, y: 0 });