From 7a591825eb682de5089441ade81ab61cdea6854a Mon Sep 17 00:00:00 2001 From: YHH <359807859@qq.com> Date: Tue, 10 Jun 2025 09:49:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=88=E7=A7=BB=E9=99=A4wasm=E5=90=8E?= =?UTF-8?q?=E7=BB=AD=E5=86=8D=E9=80=9A=E8=BF=87=E5=85=B6=E4=BB=96=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E6=8E=A5=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 - .npmignore | 6 - README.md | 2 +- package.json | 14 +- scripts/benchmark.js | 39 - scripts/build-rollup.js | 3 - scripts/build-wasm-release.js | 214 ----- src/Core.ts | 22 +- src/ECS/Core/QuerySystem.ts | 124 +-- src/ECS/Scene.ts | 3 +- src/Testing/Performance/benchmark.ts | 768 ------------------ .../Performance/component-performance.js | 53 -- src/Testing/Unit/bitmask-optimizer.test.ts | 199 ----- src/Testing/Unit/component-pool.test.ts | 189 ----- src/Testing/test-runner.ts | 182 ----- src/Utils/WasmCore.ts | 8 - src/Utils/index.ts | 13 +- tsconfig.json | 1 - wasm-release/README.md | 95 --- wasm-release/ecs_wasm_core.d.ts | 141 ---- wasm-release/ecs_wasm_core.js | 415 ---------- wasm-release/ecs_wasm_core_bg.wasm | Bin 59516 -> 0 bytes wasm-release/ecs_wasm_core_bg.wasm.d.ts | 29 - wasm-release/package.json | 23 - 24 files changed, 40 insertions(+), 2509 deletions(-) delete mode 100644 scripts/benchmark.js delete mode 100644 scripts/build-wasm-release.js delete mode 100644 src/Testing/Performance/benchmark.ts delete mode 100644 src/Testing/Performance/component-performance.js delete mode 100644 src/Testing/Unit/bitmask-optimizer.test.ts delete mode 100644 src/Testing/Unit/component-pool.test.ts delete mode 100644 src/Testing/test-runner.ts delete mode 100644 src/Utils/WasmCore.ts delete mode 100644 wasm-release/README.md delete mode 100644 wasm-release/ecs_wasm_core.d.ts delete mode 100644 wasm-release/ecs_wasm_core.js delete mode 100644 wasm-release/ecs_wasm_core_bg.wasm delete mode 100644 wasm-release/ecs_wasm_core_bg.wasm.d.ts delete mode 100644 wasm-release/package.json diff --git a/.gitignore b/.gitignore index b86fa12a..18327e16 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ yarn-error.log* # 构建输出 bin/ dist/ -wasm/ *.tgz # TypeScript @@ -49,11 +48,6 @@ logs/ coverage/ *.lcov -# Rust 构建文件 -src/wasm/*/target/ -src/wasm/*/pkg/ -Cargo.lock - # 包管理器锁文件(保留npm的,忽略其他的) yarn.lock pnpm-lock.yaml diff --git a/.npmignore b/.npmignore index d2a21cad..07701740 100644 --- a/.npmignore +++ b/.npmignore @@ -23,12 +23,6 @@ node_modules/ *.tmp *.temp -# Rust 构建文件(保留编译后的WASM) -src/wasm/rust-ecs-core/target/ -src/wasm/rust-ecs-core/Cargo.lock -src/wasm/rust-ecs-core/pkg/ -!bin/wasm/ - # 文档草稿 docs/draft/ *.draft.md diff --git a/README.md b/README.md index 5bfa1549..112c4e97 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ eventBus.emit('player:levelup', { playerId: 123, newLevel: 5 }); | **TypeScript 支持** | ✅ 原生支持 | ✅ 完整支持 | ⚠️ 部分支持 | ✅ 原生支持 | | **事件系统** | ✅ 类型安全+装饰器 | ❌ 无内置事件系统 | ⚠️ 基础事件 | ✅ 响应式事件 | | **查询系统** | ✅ 智能查询+流式API | ✅ 高性能 | ✅ 基础查询 | ✅ 响应式查询 | -| **性能优化** | ✅ 多层优化系统 | ✅ WASM优化 | ⚠️ 基础优化 | ✅ React集成优化 | +| **性能优化** | ✅ 多层优化系统 | ✅ 高性能优化 | ⚠️ 基础优化 | ✅ React集成优化 | | **实体管理器** | ✅ 统一管理接口 | ❌ 无统一接口 | ✅ 基础管理 | ✅ 响应式管理 | | **组件索引** | ✅ 哈希+位图索引 | ✅ 原生支持 | ❌ 无索引系统 | ✅ 自动索引 | | **Archetype系统** | ✅ 内置支持 | ✅ 内置支持 | ❌ 无Archetype | ❌ 无Archetype | diff --git a/package.json b/package.json index b7ba4688..c05054c0 100644 --- a/package.json +++ b/package.json @@ -19,19 +19,15 @@ "egret" ], "scripts": { - "clean": "rimraf bin wasm dist", - "clean:wasm": "rimraf src/wasm/rust-ecs-core/pkg src/wasm/rust-ecs-core/target", - "build:wasm": "cd src/wasm/rust-ecs-core && wasm-pack build --target web --out-dir ../../../bin/wasm --release", + "clean": "rimraf bin dist", "build:ts": "tsc", "prebuild": "npm run clean", - "build": "npm run build:wasm && npm run build:ts", + "build": "npm run build:ts", "build:watch": "tsc --watch", - "rebuild": "npm run clean && npm run clean:wasm && npm run build", + "rebuild": "npm run clean && npm run build", "build:npm": "npm run build && node scripts/build-rollup.js", - "build:wasm-release": "node scripts/build-wasm-release.js", - "test:benchmark": "npm run build && node bin/Testing/Performance/benchmark.js", - "test:unit": "npm run build && node bin/Testing/test-runner.js", - "benchmark": "node scripts/benchmark.js", + + "preversion": "npm run rebuild", "publish:patch": "npm version patch && npm run build:npm && cd dist && npm publish", "publish:minor": "npm version minor && npm run build:npm && cd dist && npm publish", diff --git a/scripts/benchmark.js b/scripts/benchmark.js deleted file mode 100644 index dde556fa..00000000 --- a/scripts/benchmark.js +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env node - -/** - * ECS框架性能基准测试入口 - * - * 使用方法: - * node benchmark.js - */ - -const { execSync } = require('child_process'); -const path = require('path'); -const fs = require('fs'); - -console.log('🚀 启动ECS框架性能基准测试...\n'); - -const sourceDir = path.join(__dirname, '..'); - -try { - console.log('📦 准备构建项目...'); - - // 构建TypeScript代码 - console.log('🔨 构建TypeScript代码...'); - execSync('npm run build', { - stdio: 'inherit', - cwd: sourceDir - }); - console.log('✅ TypeScript构建完成\n'); - - // 运行性能测试 - console.log('🏃 运行性能基准测试...'); - execSync('node bin/Testing/Performance/benchmark.js', { - stdio: 'inherit', - cwd: sourceDir - }); - -} catch (error) { - console.error('❌ 性能测试失败:', error.message); - process.exit(1); -} \ No newline at end of file diff --git a/scripts/build-rollup.js b/scripts/build-rollup.js index 3ab51e99..8fdfbfbf 100644 --- a/scripts/build-rollup.js +++ b/scripts/build-rollup.js @@ -106,9 +106,6 @@ function copyFiles() { console.log(` ⚠️ 文件不存在: ${src}`); } }); - - // WASM文件不再包含在npm包中,单独发布 - console.log(' ⚠️ WASM文件已移除,请从GitHub Release下载单独的WASM包'); } function showBuildResults() { diff --git a/scripts/build-wasm-release.js b/scripts/build-wasm-release.js deleted file mode 100644 index b37dfa31..00000000 --- a/scripts/build-wasm-release.js +++ /dev/null @@ -1,214 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const { execSync } = require('child_process'); - -console.log('🚀 构建 WASM 发布包...'); - -async function main() { - try { - // 构建通用版本 - console.log('🌐 构建通用 WASM 版本...'); - await buildUniversalVersion(); - - console.log('\n✅ WASM 发布包构建完成!'); - console.log('📦 输出目录: wasm-release/'); - console.log('💡 可以将整个目录打包为 zip 文件上传到 GitHub Release'); - - } catch (error) { - console.error('❌ 构建失败:', error.message); - process.exit(1); - } -} - - - -async function buildUniversalVersion() { - // 确保通用 WASM 已构建 - if (!fs.existsSync('./bin/wasm')) { - console.log('📦 构建通用 WASM...'); - execSync('npm run build:wasm', { stdio: 'inherit' }); - } - - // 创建发布目录 - const releaseDir = './wasm-release'; - if (fs.existsSync(releaseDir)) { - execSync(`rimraf ${releaseDir}`, { stdio: 'inherit' }); - } - fs.mkdirSync(releaseDir); - - // 复制 WASM 文件 - console.log('📁 复制 WASM 文件...'); - const wasmDir = './bin/wasm'; - fs.readdirSync(wasmDir).forEach(file => { - if (file !== '.gitignore') { - fs.copyFileSync( - path.join(wasmDir, file), - path.join(releaseDir, file) - ); - console.log(` ✓ ${file}`); - } - }); - - // 生成包信息 - console.log('📋 生成包信息...'); - generatePackageInfo(releaseDir); - - // 创建使用说明 - console.log('📋 生成使用说明...'); - generateUsageInstructions(releaseDir); - - // 显示结果 - showReleaseResults(releaseDir); -} - -function generatePackageInfo(releaseDir) { - const packageInfo = { - name: "@esengine/ecs-framework-wasm", - version: "1.0.0", - description: "ECS Framework WASM 加速模块", - main: "ecs_wasm_core.js", - files: [ - "ecs_wasm_core.js", - "ecs_wasm_core_bg.wasm", - "*.d.ts", - "README.md" - ], - keywords: ["ecs", "wasm", "game-engine", "performance"], - author: "ESEngine Team", - license: "MIT", - peerDependencies: { - "@esengine/ecs-framework": "^1.0.0" - } - }; - - fs.writeFileSync( - path.join(releaseDir, 'package.json'), - JSON.stringify(packageInfo, null, 2) - ); -} - -function generateUsageInstructions(releaseDir) { - const instructions = `# ECS Framework WASM 支持包 - -这个包包含了 @esengine/ecs-framework 的 WASM 加速模块。 - -## 包含文件 - -- \`ecs_wasm_core.js\` - WASM 胶水代码 -- \`ecs_wasm_core.d.ts\` - TypeScript 类型定义 -- \`ecs_wasm_core_bg.wasm\` - WASM 二进制文件 -- \`ecs_wasm_core_bg.wasm.d.ts\` - WASM 类型定义 -- \`package.json\` - 包信息 - -## 使用方法 - -### Node.js 环境 - -\`\`\`javascript -import init, { EcsCore } from './ecs_wasm_core.js'; - -async function useWasm() { - // 初始化 WASM 模块 - await init(); - - // 创建 ECS 核心实例 - const ecsCore = new EcsCore(); - - // 使用 WASM 加速的 ECS 功能 - const entity = ecsCore.create_entity(); - console.log('创建实体:', entity); -} - -useWasm(); -\`\`\` - -### 浏览器环境 - -\`\`\`html - - - - - - -

ECS Framework WASM Demo

- - -\`\`\` - -### TypeScript 支持 - -确保包含类型定义: - -\`\`\`typescript -import init, { EcsCore } from './ecs_wasm_core.js'; - -async function typedExample(): Promise { - await init(); - - const ecsCore = new EcsCore(); - const entityId: number = ecsCore.create_entity(); - - // 使用类型安全的 API - const mask = BigInt(0b1010); - ecsCore.update_entity_mask(entityId, mask); -} -\`\`\` - -## 性能优势 - -WASM 模块主要优化以下操作: - -- 🚀 实体查询(10-100x 性能提升) -- 🔥 组件掩码操作 -- ⚡ 批量实体处理 - -## 兼容性 - -- **浏览器**: 支持 WebAssembly 的现代浏览器 -- **Node.js**: 16.0+ 版本 -- **TypeScript**: 4.0+ 版本 - -## 许可证 - -MIT License - 详见 LICENSE 文件 -`; - - fs.writeFileSync(path.join(releaseDir, 'README.md'), instructions); -} - -function showReleaseResults(releaseDir) { - const files = fs.readdirSync(releaseDir); - const totalSize = files.reduce((size, file) => { - const filePath = path.join(releaseDir, file); - const stats = fs.statSync(filePath); - return size + stats.size; - }, 0); - - console.log(`\n📦 发布包内容 (${releaseDir}):`); - files.forEach(file => { - const filePath = path.join(releaseDir, file); - const stats = fs.statSync(filePath); - const sizeKB = (stats.size / 1024).toFixed(1); - console.log(` ✓ ${file} (${sizeKB} KB)`); - }); - - console.log(`\n📊 总计 ${files.length} 个文件,大小: ${(totalSize / 1024).toFixed(1)} KB`); -} - -if (require.main === module) { - main(); -} - -module.exports = { main }; \ No newline at end of file diff --git a/src/Core.ts b/src/Core.ts index b8c230c6..1bb07570 100644 --- a/src/Core.ts +++ b/src/Core.ts @@ -189,32 +189,14 @@ export class Core { * @param options - 额外的配置选项 * @returns Core实例 */ - public static create(debug: boolean = true, options?: { disableWasm?: boolean }): Core { + public static create(debug: boolean = true): Core { if (this._instance == null) { this._instance = new Core(debug); - - // 如果指定禁用WASM,设置静默模式 - if (options?.disableWasm) { - this.disableWasm(); - } } return this._instance; } - /** - * 禁用WASM支持 - * - * 当WASM加载失败或在不支持的环境中使用时调用。 - * 这将使ECS系统使用JavaScript回退实现。 - */ - public static disableWasm(): void { - // 动态导入WASM实例并设置为静默模式 - import('./Utils/Wasm/instance').then(({ ecsCore }) => { - ecsCore.setSilent(true); - }).catch(() => { - // 如果导入失败,忽略错误 - }); - } + /** * 注册全局管理器 diff --git a/src/ECS/Core/QuerySystem.ts b/src/ECS/Core/QuerySystem.ts index 0ecfb220..d7924233 100644 --- a/src/ECS/Core/QuerySystem.ts +++ b/src/ECS/Core/QuerySystem.ts @@ -1,7 +1,7 @@ import { Entity } from '../Entity'; import { Component } from '../Component'; import { ComponentRegistry, ComponentType } from './ComponentStorage'; -import { ecsCore } from '../../Utils/WasmCore'; + import { ComponentPoolManager } from './ComponentPool'; import { BitMaskOptimizer } from './BitMaskOptimizer'; import { IndexUpdateBatcher } from './IndexUpdateBatcher'; @@ -84,7 +84,6 @@ interface QueryCacheEntry { */ export class QuerySystem { private entities: Entity[] = []; - private wasmAvailable = false; private entityIndex: EntityIndex; private indexDirty = true; @@ -150,31 +149,9 @@ export class QuerySystem { this.addEntityToIndexes(update.entity); } }; - - this.initializeWasm(); } - /** - * 初始化WebAssembly支持 - * - * 自动检测运行环境并启用WebAssembly计算加速。 - * 如果WebAssembly不可用,系统将自动回退到JavaScript实现。 - */ - private async initializeWasm(): Promise { - try { - const wasmLoaded = await ecsCore.initialize(); - this.wasmAvailable = wasmLoaded && ecsCore.isUsingWasm(); - if (this.wasmAvailable) { - console.log('QuerySystem: WebAssembly计算加速已启用'); - } else { - console.log('QuerySystem: 使用JavaScript实现'); - } - } catch (error) { - console.warn('QuerySystem: WebAssembly初始化失败,使用JavaScript实现:', error); - this.wasmAvailable = false; - } - } /** * 设置实体列表并重建索引 @@ -859,7 +836,6 @@ export class QuerySystem { * 批量更新实体组件 * * 对大量实体进行批量组件更新操作。 - * 当更新数量超过阈值时,系统会自动使用WebAssembly加速。 * * @param updates 更新操作列表,包含实体ID和新的组件掩码 * @@ -874,80 +850,33 @@ export class QuerySystem { * ``` */ public batchUpdateComponents(updates: Array<{ entityId: number, componentMask: bigint }>): void { - if (this.wasmAvailable && updates.length > 100) { - try { - const entityIds = updates.map(u => u.entityId); - const masks = updates.map(u => u.componentMask); - ecsCore.batchUpdateMasks(entityIds, masks); - console.log(`WebAssembly加速批量更新 ${updates.length} 个实体`); - } catch (error) { - console.warn('WebAssembly批量更新失败,回退到JavaScript实现:', error); - this.batchUpdateComponentsJS(updates); + // 批量处理更新,先从索引中移除,再重新添加 + const entitiesToUpdate: Entity[] = []; + + for (const update of updates) { + const entity = this.entities.find(e => e.id === update.entityId); + if (entity) { + // 先从所有索引中移除 + this.removeEntityFromIndexes(entity); + entitiesToUpdate.push(entity); } - } else { - this.batchUpdateComponentsJS(updates); } - + + // 重新添加到索引中(此时实体的组件掩码已经更新) + for (const entity of entitiesToUpdate) { + this.addEntityToIndexes(entity); + } + + // 标记脏实体进行处理 + for (const entity of entitiesToUpdate) { + this.dirtyTrackingSystem.markDirty(entity, DirtyFlag.COMPONENT_MODIFIED, []); + } + // 批量更新后清除缓存 this.clearQueryCache(); } - /** - * JavaScript实现的批量更新 - */ - private batchUpdateComponentsJS(updates: Array<{ entityId: number, componentMask: bigint }>): void { - for (const update of updates) { - const entity = this.entities.find(e => e.id === update.entityId); - if (entity) { - // 注意:componentMask是只读属性,实际应用中需要通过添加/移除组件来更新 - console.log(`更新实体 ${update.entityId} 的组件掩码: ${update.componentMask}`); - } - } - this.rebuildIndexes(); - } - /** - * 获取加速状态信息 - * - * 返回当前查询系统的加速状态和性能信息。 - * 包括WebAssembly可用性、缓存统计等详细信息。 - * - * @returns 加速状态信息对象 - */ - public getAccelerationStatus(): { - wasmEnabled: boolean; - currentProvider: string; - availableProviders: string[]; - performanceInfo?: any; - } { - return { - wasmEnabled: this.wasmAvailable, - currentProvider: this.wasmAvailable ? 'hybrid' : 'javascript', - availableProviders: ['javascript', 'hybrid'], - performanceInfo: { - entityCount: this.entities.length, - wasmEnabled: this.wasmAvailable, - cacheStats: { - size: this.queryCache.size, - hitRate: this.queryStats.totalQueries > 0 ? - (this.queryStats.cacheHits / this.queryStats.totalQueries * 100).toFixed(2) + '%' : '0%' - } - } - }; - } - - /** - * 切换加速提供者 - * - * 兼容性接口,保持向后兼容。 - * 系统会自动选择最佳的实现方式。 - * - * @param providerName 提供者名称 - * @returns 是否切换成功 - */ - public async switchAccelerationProvider(providerName: string): Promise { - return true; - } /** * 创建组件掩码 @@ -986,7 +915,6 @@ export class QuerySystem { tagIndexSize: number; nameIndexSize: number; }; - accelerationStatus: ReturnType; queryStats: { totalQueries: number; cacheHits: number; @@ -1001,6 +929,10 @@ export class QuerySystem { archetypeSystem: any; dirtyTracking: any; }; + cacheStats: { + size: number; + hitRate: string; + }; } { return { entityCount: this.entities.length, @@ -1010,7 +942,6 @@ export class QuerySystem { tagIndexSize: this.entityIndex.byTag.size, nameIndexSize: this.entityIndex.byName.size }, - accelerationStatus: this.getAccelerationStatus(), queryStats: { ...this.queryStats, cacheHitRate: this.queryStats.totalQueries > 0 ? @@ -1024,6 +955,11 @@ export class QuerySystem { entityCount: a.entities.length })), dirtyTracking: this.dirtyTrackingSystem.getStats() + }, + cacheStats: { + size: this.queryCache.size, + hitRate: this.queryStats.totalQueries > 0 ? + (this.queryStats.cacheHits / this.queryStats.totalQueries * 100).toFixed(2) + '%' : '0%' } }; } diff --git a/src/ECS/Scene.ts b/src/ECS/Scene.ts index 7d2e1e6a..3c90e14c 100644 --- a/src/ECS/Scene.ts +++ b/src/ECS/Scene.ts @@ -91,9 +91,8 @@ export class Scene { /** * 创建场景实例 - * @param enableWasmAcceleration 是否启用WebAssembly加速,默认为true */ - constructor(enableWasmAcceleration: boolean = true) { + constructor() { this.entities = new EntityList(this); this.entityProcessors = new EntityProcessorList(); this.identifierPool = new IdentifierPool(); diff --git a/src/Testing/Performance/benchmark.ts b/src/Testing/Performance/benchmark.ts deleted file mode 100644 index 1de03b23..00000000 --- a/src/Testing/Performance/benchmark.ts +++ /dev/null @@ -1,768 +0,0 @@ -/** - * ECS框架性能基准测试 - * 测试框架在不同场景下的性能表现 - */ - -import { Scene } from '../../ECS/Scene'; -import { Entity } from '../../ECS/Entity'; -import { Component } from '../../ECS/Component'; - -console.log('🚀 ECS框架性能基准测试'); -console.log('============================================================'); -console.log('测试目标: 评估ECS框架在不同场景下的性能表现'); -console.log('============================================================'); - -/** - * 位置组件 - */ -class PositionComponent extends Component { - public x: number = 0; - public y: number = 0; - - constructor(x: number = 0, y: number = 0) { - super(); - this.x = x; - this.y = y; - } -} - -/** - * 速度组件 - */ -class VelocityComponent extends Component { - public vx: number = 0; - public vy: number = 0; - - constructor(vx: number = 0, vy: number = 0) { - super(); - this.vx = vx; - this.vy = vy; - } -} - -/** - * 生命值组件 - */ -class HealthComponent extends Component { - public health: number = 100; - public maxHealth: number = 100; - - constructor(health: number = 100) { - super(); - this.health = health; - this.maxHealth = health; - } -} - -/** - * 渲染组件 - */ -class RenderComponent extends Component { - public sprite: string = ''; - public visible: boolean = true; - - constructor(sprite: string = '') { - super(); - this.sprite = sprite; - } -} - -/** - * AI组件 - */ -class AIComponent extends Component { - public state: string = 'idle'; - public target: Entity | null = null; - - constructor(state: string = 'idle') { - super(); - this.state = state; - } -} - -/** - * 测试配置接口 - */ -interface TestConfig { - entityCounts: number[]; - queryIterations: number; - updateIterations: number; -} - -/** - * 测试配置 - */ -const TEST_CONFIG: TestConfig = { - entityCounts: [1000, 5000, 10000, 25000, 50000, 100000, 200000, 500000], - queryIterations: 1000, - updateIterations: 100 -}; - -/** - * 性能测试结果 - */ -interface PerformanceResult { - entityCount: number; - singleQuery: number; - multiQuery: number; - complexQuery: number; - tagQuery: number; - singleTagQuery: number; - entityUpdate: number; - memoryUsage: number; -} - -/** - * 测试创建实体的性能 - */ -function testEntityCreation(scene: Scene, count: number): { - totalTime: number; - averageTime: number; - entitiesPerSecond: number; - breakdown: { - entityCreation: number; - componentAddition: number; - tagAssignment: number; - }; -} { - const startTime = performance.now(); - let entityCreationTime = 0; - let componentAdditionTime = 0; - let tagAssignmentTime = 0; - - // 批量创建实体(不添加组件) - const entityStart = performance.now(); - const entities = scene.createEntities(count, "Entity"); - entityCreationTime = performance.now() - entityStart; - - // 批量添加组件 - const componentStart = performance.now(); - for (let i = 0; i < entities.length; i++) { - const entity = entities[i]; - - // 所有实体都有位置组件 - entity.addComponent(new PositionComponent( - Math.random() * 1000, - Math.random() * 1000 - )); - - // 70%的实体有速度组件 - if (Math.random() < 0.7) { - entity.addComponent(new VelocityComponent( - (Math.random() - 0.5) * 10, - (Math.random() - 0.5) * 10 - )); - } - - // 50%的实体有生命值组件 - if (Math.random() < 0.5) { - entity.addComponent(new HealthComponent( - Math.floor(Math.random() * 100) + 50 - )); - } - - // 30%的实体有渲染组件 - if (Math.random() < 0.3) { - entity.addComponent(new RenderComponent(`sprite_${i % 10}`)); - } - - // 20%的实体有AI组件 - if (Math.random() < 0.2) { - entity.addComponent(new AIComponent(['idle', 'patrol', 'chase'][Math.floor(Math.random() * 3)])); - } - } - componentAdditionTime = performance.now() - componentStart; - - // 批量设置标签 - const tagStart = performance.now(); - for (const entity of entities) { - entity.tag = Math.floor(Math.random() * 10); - } - tagAssignmentTime = performance.now() - tagStart; - - const totalTime = performance.now() - startTime; - - return { - totalTime, - averageTime: totalTime / count, - entitiesPerSecond: count / (totalTime / 1000), - breakdown: { - entityCreation: entityCreationTime, - componentAddition: componentAdditionTime, - tagAssignment: tagAssignmentTime - } - }; -} - -/** - * 创建测试实体 - */ -function createTestEntities(scene: Scene, count: number): Entity[] { - const entities: Entity[] = []; - - for (let i = 0; i < count; i++) { - const entity = scene.createEntity(`Entity_${i}`); - - // 所有实体都有位置组件 - entity.addComponent(new PositionComponent( - Math.random() * 1000, - Math.random() * 1000 - )); - - // 70%的实体有速度组件 - if (Math.random() < 0.7) { - entity.addComponent(new VelocityComponent( - (Math.random() - 0.5) * 10, - (Math.random() - 0.5) * 10 - )); - } - - // 50%的实体有生命值组件 - if (Math.random() < 0.5) { - entity.addComponent(new HealthComponent( - Math.floor(Math.random() * 100) + 50 - )); - } - - // 30%的实体有渲染组件 - if (Math.random() < 0.3) { - entity.addComponent(new RenderComponent(`sprite_${i % 10}`)); - } - - // 20%的实体有AI组件 - if (Math.random() < 0.2) { - entity.addComponent(new AIComponent(['idle', 'patrol', 'chase'][Math.floor(Math.random() * 3)])); - } - - // 设置随机标签 - entity.tag = Math.floor(Math.random() * 10); - - entities.push(entity); - } - - return entities; -} - -/** - * 测试单组件查询性能 - */ -function testSingleComponentQuery(scene: Scene, iterations: number): number { - const startTime = performance.now(); - - for (let i = 0; i < iterations; i++) { - scene.querySystem.queryAll(PositionComponent); - } - - return performance.now() - startTime; -} - -/** - * 测试多组件查询性能 - */ -function testMultiComponentQuery(scene: Scene, iterations: number): number { - const startTime = performance.now(); - - for (let i = 0; i < iterations; i++) { - scene.querySystem.queryAll(PositionComponent, VelocityComponent); - } - - return performance.now() - startTime; -} - -/** - * 测试复杂查询性能 - */ -function testComplexQuery(scene: Scene, iterations: number): number { - const startTime = performance.now(); - - for (let i = 0; i < iterations; i++) { - scene.querySystem.queryAll(PositionComponent, VelocityComponent, HealthComponent); - } - - return performance.now() - startTime; -} - -/** - * 测试标签查询性能 - */ -function testTagQuery(scene: Scene, iterations: number): number { - const startTime = performance.now(); - - // 优化:预先获取所有标签查询结果,然后重复使用 - // 这更符合实际游戏中的使用模式 - const tags = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; - - for (let i = 0; i < iterations; i++) { - // 批量查询所有标签 - for (const tag of tags) { - scene.querySystem.queryByTag(tag); - } - } - - return performance.now() - startTime; -} - -/** - * 测试单个标签查询性能 - */ -function testSingleTagQuery(scene: Scene, iterations: number): number { - const startTime = performance.now(); - - // 只查询标签0,测试单个标签的查询性能和缓存效果 - for (let i = 0; i < iterations; i++) { - scene.querySystem.queryByTag(0); - } - - return performance.now() - startTime; -} - -/** - * 测试实体更新性能 - */ -function testEntityUpdate(scene: Scene, iterations: number): number { - const entities = scene.querySystem.queryAll(PositionComponent, VelocityComponent).entities; - const startTime = performance.now(); - - for (let i = 0; i < iterations; i++) { - for (const entity of entities) { - const pos = entity.getComponent(PositionComponent); - const vel = entity.getComponent(VelocityComponent); - if (pos && vel) { - pos.x += vel.vx; - pos.y += vel.vy; - } - } - } - - return performance.now() - startTime; -} - -/** - * 获取内存使用情况 - */ -function getMemoryUsage(): number { - if (typeof process !== 'undefined' && process.memoryUsage) { - return process.memoryUsage().heapUsed / 1024 / 1024; // MB - } - return 0; -} - -/** - * 运行性能测试 - */ -function runPerformanceTest(scene: Scene, entityCount: number, config: TestConfig): PerformanceResult { - console.log(`\n📊 测试 ${entityCount.toLocaleString()} 个实体...`); - - // 测试实体创建性能 - const startMemory = getMemoryUsage(); - console.log(` 🔧 测试实体创建性能...`); - const creationStats = testEntityCreation(scene, entityCount); - const endMemory = getMemoryUsage(); - - console.log(` 📈 实体创建性能分析:`); - console.log(` 总时间: ${creationStats.totalTime.toFixed(2)}ms`); - console.log(` 平均时间: ${creationStats.averageTime.toFixed(4)}ms/实体`); - console.log(` 创建速度: ${creationStats.entitiesPerSecond.toFixed(0)} 实体/秒`); - console.log(` 时间分解:`); - console.log(` - 实体创建: ${creationStats.breakdown.entityCreation.toFixed(2)}ms (${(creationStats.breakdown.entityCreation / creationStats.totalTime * 100).toFixed(1)}%)`); - console.log(` - 组件添加: ${creationStats.breakdown.componentAddition.toFixed(2)}ms (${(creationStats.breakdown.componentAddition / creationStats.totalTime * 100).toFixed(1)}%)`); - console.log(` - 标签分配: ${creationStats.breakdown.tagAssignment.toFixed(2)}ms (${(creationStats.breakdown.tagAssignment / creationStats.totalTime * 100).toFixed(1)}%)`); - console.log(` 内存使用: ${(endMemory - startMemory).toFixed(1)}MB`); - - // 运行测试 - console.log(` 🔍 执行查询测试...`); - const singleQuery = testSingleComponentQuery(scene, config.queryIterations); - const multiQuery = testMultiComponentQuery(scene, config.queryIterations); - const complexQuery = testComplexQuery(scene, config.queryIterations); - const tagQuery = testTagQuery(scene, config.queryIterations); - const singleTagQuery = testSingleTagQuery(scene, config.queryIterations); - - console.log(` ⚡ 执行更新测试...`); - const entityUpdate = testEntityUpdate(scene, config.updateIterations); - - console.log(` ✅ 测试完成`); - - return { - entityCount, - singleQuery, - multiQuery, - complexQuery, - tagQuery, - singleTagQuery, - entityUpdate, - memoryUsage: endMemory - startMemory - }; -} - -/** - * 显示系统信息 - */ -function displaySystemInfo(scene: Scene): void { - const status = scene.querySystem.getAccelerationStatus(); - const stats = scene.querySystem.getStats(); - - console.log('\n🔍 系统信息:'); - console.log(` 当前提供者: ${status.currentProvider}`); - console.log(` WebAssembly: ${status.wasmEnabled ? '已启用' : '未启用'}`); - console.log(` 可用提供者: ${status.availableProviders.join(', ')}`); - console.log(` 索引统计:`); - console.log(` 组件掩码索引: ${stats.indexStats.maskIndexSize}`); - console.log(` 组件类型索引: ${stats.indexStats.componentIndexSize}`); - console.log(` 标签索引: ${stats.indexStats.tagIndexSize}`); - console.log(` 名称索引: ${stats.indexStats.nameIndexSize}`); - - if (status.performanceInfo?.cacheStats) { - console.log(` 查询缓存:`); - console.log(` 缓存大小: ${status.performanceInfo.cacheStats.size}`); - console.log(` 命中率: ${status.performanceInfo.cacheStats.hitRate}`); - } -} - -/** - * 显示性能结果 - */ -function displayResults(results: PerformanceResult[], scene: Scene): void { - console.log('\n📈 ECS框架性能测试结果'); - console.log('='.repeat(130)); - console.log('| 实体数量 | 单组件查询 | 双组件查询 | 三组件查询 | 多标签查询 | 单标签查询 | 实体更新 | 内存使用 |'); - console.log('|' + '-'.repeat(128) + '|'); - - for (const result of results) { - const entityCount = result.entityCount.toLocaleString().padStart(9); - const singleQuery = `${result.singleQuery.toFixed(2)}ms`.padStart(10); - const multiQuery = `${result.multiQuery.toFixed(2)}ms`.padStart(10); - const complexQuery = `${result.complexQuery.toFixed(2)}ms`.padStart(10); - const tagQuery = `${result.tagQuery.toFixed(2)}ms`.padStart(10); - const singleTagQuery = `${result.singleTagQuery.toFixed(2)}ms`.padStart(10); - const entityUpdate = `${result.entityUpdate.toFixed(2)}ms`.padStart(9); - const memoryUsage = `${result.memoryUsage.toFixed(1)}MB`.padStart(9); - - console.log(`| ${entityCount} | ${singleQuery} | ${multiQuery} | ${complexQuery} | ${tagQuery} | ${singleTagQuery} | ${entityUpdate} | ${memoryUsage} |`); - } - - console.log('|' + '-'.repeat(128) + '|'); - - // 计算性能指标 - const maxEntities = Math.max(...results.map(r => r.entityCount)); - const maxResult = results.find(r => r.entityCount === maxEntities)!; - - console.log(`\n🎯 性能峰值 (${maxEntities.toLocaleString()} 个实体):`); - console.log(` 单组件查询: ${(TEST_CONFIG.queryIterations / maxResult.singleQuery * 1000).toFixed(0)} 次/秒`); - console.log(` 双组件查询: ${(TEST_CONFIG.queryIterations / maxResult.multiQuery * 1000).toFixed(0)} 次/秒`); - console.log(` 三组件查询: ${(TEST_CONFIG.queryIterations / maxResult.complexQuery * 1000).toFixed(0)} 次/秒`); - console.log(` 多标签查询: ${(TEST_CONFIG.queryIterations * 10 / maxResult.tagQuery * 1000).toFixed(0)} 次/秒`); - console.log(` 单标签查询: ${(TEST_CONFIG.queryIterations / maxResult.singleTagQuery * 1000).toFixed(0)} 次/秒`); - console.log(` 实体更新: ${(maxResult.entityCount * TEST_CONFIG.updateIterations / maxResult.entityUpdate * 1000).toFixed(0)} 个/秒`); - console.log(` 内存效率: ${(maxResult.entityCount / (maxResult.memoryUsage || 1)).toFixed(0)} 实体/MB`); - - // 性能评级 - const avgQueryTime = (maxResult.singleQuery + maxResult.multiQuery + maxResult.complexQuery + maxResult.singleTagQuery) / 4; - let rating = ''; - if (avgQueryTime < 50) rating = '🚀 优秀'; - else if (avgQueryTime < 100) rating = '✅ 良好'; - else if (avgQueryTime < 200) rating = '⚠️ 一般'; - else rating = '❌ 需要优化'; - - console.log(`\n📊 性能评级: ${rating}`); - console.log(` 平均查询时间: ${avgQueryTime.toFixed(2)}ms`); - - // 显示查询统计信息 - const queryStats = scene.querySystem.getStats().queryStats; - console.log(`\n🔍 查询统计:`); - console.log(` 总查询次数: ${queryStats.totalQueries.toLocaleString()}`); - console.log(` 缓存命中: ${queryStats.cacheHits.toLocaleString()}`); - console.log(` 索引命中: ${queryStats.indexHits.toLocaleString()}`); - console.log(` 线性扫描: ${queryStats.linearScans.toLocaleString()}`); - console.log(` 缓存命中率: ${queryStats.cacheHitRate}`); - - // 标签查询性能分析 - console.log(`\n🏷️ 标签查询分析:`); - const tagQueryRatio = maxResult.tagQuery / maxResult.singleTagQuery; - console.log(` 多标签查询 vs 单标签查询: ${tagQueryRatio.toFixed(2)}x (预期约10x)`); - if (tagQueryRatio > 15) { - console.log(` ⚠️ 多标签查询性能异常,可能存在缓存问题`); - } else if (tagQueryRatio < 5) { - console.log(` ✅ 标签查询缓存效果良好`); - } else { - console.log(` 📊 标签查询性能正常`); - } - - // 性能改进分析 - const improvement = calculatePerformanceImprovement(results); - if (improvement) { - console.log(`\n📈 性能改进分析:`); - console.log(` 双组件查询改进: ${improvement.multiQuery}x`); - console.log(` 三组件查询改进: ${improvement.complexQuery}x`); - console.log(` 整体查询改进: ${improvement.overall}x`); - } - - // 扩展性分析 - console.log(`\n📊 扩展性分析:`); - analyzeScalability(results); -} - -/** - * 计算性能改进(与优化前对比) - */ -function calculatePerformanceImprovement(results: PerformanceResult[]): { - multiQuery: string; - complexQuery: string; - overall: string; -} | null { - // 基于50,000实体的结果进行分析 - const maxResult = results.find(r => r.entityCount === 50000); - if (!maxResult) return null; - - // 优化前的基准时间(基于之前的测试结果) - const baselineMultiQuery = 1270.54; // ms - const baselineComplexQuery = 981.76; // ms - - const multiImprovement = (baselineMultiQuery / maxResult.multiQuery).toFixed(2); - const complexImprovement = (baselineComplexQuery / maxResult.complexQuery).toFixed(2); - const overallImprovement = ((baselineMultiQuery + baselineComplexQuery) / - (maxResult.multiQuery + maxResult.complexQuery)).toFixed(2); - - return { - multiQuery: multiImprovement, - complexQuery: complexImprovement, - overall: overallImprovement - }; -} - -/** - * 分析系统扩展性 - */ -function analyzeScalability(results: PerformanceResult[]): void { - if (results.length < 2) return; - - // 分析查询时间随实体数量的变化趋势 - const first = results[0]; - const last = results[results.length - 1]; - - const entityRatio = last.entityCount / first.entityCount; - const singleQueryRatio = last.singleQuery / first.singleQuery; - const multiQueryRatio = last.multiQuery / first.multiQuery; - const complexQueryRatio = last.complexQuery / first.complexQuery; - - console.log(` 实体数量增长: ${entityRatio.toFixed(1)}x (${first.entityCount.toLocaleString()} → ${last.entityCount.toLocaleString()})`); - console.log(` 单组件查询时间增长: ${singleQueryRatio.toFixed(2)}x`); - console.log(` 双组件查询时间增长: ${multiQueryRatio.toFixed(2)}x`); - console.log(` 三组件查询时间增长: ${complexQueryRatio.toFixed(2)}x`); - - // 计算复杂度 - const avgComplexity = (singleQueryRatio + multiQueryRatio + complexQueryRatio) / 3; - let complexityRating = ''; - if (avgComplexity < entityRatio * 0.1) complexityRating = '🚀 近似O(1) - 优秀'; - else if (avgComplexity < entityRatio * 0.5) complexityRating = '✅ 亚线性 - 良好'; - else if (avgComplexity < entityRatio) complexityRating = '⚠️ 接近线性 - 一般'; - else complexityRating = '❌ 超线性 - 需要优化'; - - console.log(` 时间复杂度评估: ${complexityRating}`); - - // 内存效率分析 - const memoryEfficiencyFirst = first.entityCount / first.memoryUsage; - const memoryEfficiencyLast = last.entityCount / last.memoryUsage; - const memoryEfficiencyRatio = memoryEfficiencyLast / memoryEfficiencyFirst; - - console.log(` 内存效率变化: ${memoryEfficiencyRatio.toFixed(2)}x (${memoryEfficiencyFirst.toFixed(0)} → ${memoryEfficiencyLast.toFixed(0)} 实体/MB)`); -} - -/** - * 专门测试实体创建性能 - */ -async function runEntityCreationBenchmark(): Promise { - console.log('\n🚀 实体创建性能基准测试'); - console.log('='.repeat(60)); - - const testCounts = [1000, 5000, 10000, 50000, 100000]; - - for (const count of testCounts) { - console.log(`\n📊 测试创建 ${count.toLocaleString()} 个实体:`); - - // 创建新场景 - const scene = new Scene(); - - // 测试创建性能 - const stats = testEntityCreation(scene, count); - - console.log(` 总时间: ${stats.totalTime.toFixed(2)}ms`); - console.log(` 平均时间: ${stats.averageTime.toFixed(4)}ms/实体`); - console.log(` 创建速度: ${stats.entitiesPerSecond.toFixed(0)} 实体/秒`); - console.log(` 时间分解:`); - console.log(` - 实体创建: ${stats.breakdown.entityCreation.toFixed(2)}ms (${(stats.breakdown.entityCreation / stats.totalTime * 100).toFixed(1)}%)`); - console.log(` - 组件添加: ${stats.breakdown.componentAddition.toFixed(2)}ms (${(stats.breakdown.componentAddition / stats.totalTime * 100).toFixed(1)}%)`); - console.log(` - 标签分配: ${stats.breakdown.tagAssignment.toFixed(2)}ms (${(stats.breakdown.tagAssignment / stats.totalTime * 100).toFixed(1)}%)`); - - // 分析性能瓶颈 - const { entityCreation, componentAddition, tagAssignment } = stats.breakdown; - const total = stats.totalTime; - - console.log(` 性能瓶颈分析:`); - if (componentAddition / total > 0.5) { - console.log(` ⚠️ 组件添加是主要瓶颈 (${(componentAddition / total * 100).toFixed(1)}%)`); - } - if (entityCreation / total > 0.3) { - console.log(` ⚠️ 实体创建开销较高 (${(entityCreation / total * 100).toFixed(1)}%)`); - } - if (tagAssignment / total > 0.1) { - console.log(` ⚠️ 标签分配开销异常 (${(tagAssignment / total * 100).toFixed(1)}%)`); - } - - // 分析组件添加性能(仅对较小的测试集) - if (count <= 10000) { - analyzeComponentAdditionPerformance(new Scene(), Math.min(count, 5000)); - } - - // 清理场景 - scene.end(); - } - - console.log('\n📈 实体创建性能总结:'); - console.log(' 主要性能瓶颈通常在组件添加阶段'); - console.log(' 建议优化方向:'); - console.log(' 1. 减少组件注册开销'); - console.log(' 2. 优化位掩码计算'); - console.log(' 3. 减少内存分配次数'); - console.log(' 4. 使用对象池复用组件实例'); -} - -/** - * 测试组件添加性能的详细分析 - */ -function analyzeComponentAdditionPerformance(scene: Scene, count: number): void { - console.log(`\n🔬 组件添加性能详细分析 (${count.toLocaleString()} 个实体):`); - - // 创建实体但不添加组件 - const entities = scene.createEntities(count, "TestEntity"); - - // 分别测试每种组件的添加性能 - const componentTests = [ - { - name: "PositionComponent", - create: () => new PositionComponent(Math.random() * 1000, Math.random() * 1000), - probability: 1.0 - }, - { - name: "VelocityComponent", - create: () => new VelocityComponent((Math.random() - 0.5) * 10, (Math.random() - 0.5) * 10), - probability: 0.7 - }, - { - name: "HealthComponent", - create: () => new HealthComponent(Math.floor(Math.random() * 100) + 50), - probability: 0.5 - }, - { - name: "RenderComponent", - create: () => new RenderComponent(`sprite_${Math.floor(Math.random() * 10)}`), - probability: 0.3 - }, - { - name: "AIComponent", - create: () => new AIComponent(['idle', 'patrol', 'chase'][Math.floor(Math.random() * 3)]), - probability: 0.2 - } - ]; - - for (const test of componentTests) { - const startTime = performance.now(); - let addedCount = 0; - - for (const entity of entities) { - if (Math.random() < test.probability) { - entity.addComponent(test.create()); - addedCount++; - } - } - - const endTime = performance.now(); - const totalTime = endTime - startTime; - - console.log(` ${test.name}:`); - console.log(` 添加数量: ${addedCount.toLocaleString()}`); - console.log(` 总时间: ${totalTime.toFixed(2)}ms`); - console.log(` 平均时间: ${(totalTime / addedCount).toFixed(4)}ms/组件`); - console.log(` 添加速度: ${(addedCount / (totalTime / 1000)).toFixed(0)} 组件/秒`); - } -} - -/** - * 主测试函数 - */ -async function runBenchmarks(): Promise { - console.log('🎯 ECS框架性能基准测试'); - console.log('='.repeat(60)); - - // 先运行实体创建性能测试 - await runEntityCreationBenchmark(); - - // 然后运行完整的框架测试 - console.log('\n🚀 完整框架性能测试'); - console.log('='.repeat(60)); - - console.log(`\n⚙️ 测试配置:`); - console.log(` 实体数量: ${TEST_CONFIG.entityCounts.map(n => n.toLocaleString()).join(', ')}`); - console.log(` 查询迭代: ${TEST_CONFIG.queryIterations.toLocaleString()}`); - console.log(` 更新迭代: ${TEST_CONFIG.updateIterations.toLocaleString()}`); - console.log(` 预计测试时间: ${(TEST_CONFIG.entityCounts.length * 2).toFixed(0)}-${(TEST_CONFIG.entityCounts.length * 5).toFixed(0)} 分钟`); - - console.log('\n🔧 初始化ECS框架...'); - - // 初始化WebAssembly模块 - try { - const { ecsCore } = await import('../../Utils/WasmCore'); - await ecsCore.initialize(); - console.log(`✅ WebAssembly模块: ${ecsCore.isUsingWasm() ? '已加载' : '未加载'}`); - } catch (error) { - console.log('⚠️ WebAssembly模块加载失败,使用JavaScript实现'); - } - - const scene = new Scene(); - - // 等待初始化完成 - await new Promise(resolve => setTimeout(resolve, 1000)); - - displaySystemInfo(scene); - - const results: PerformanceResult[] = []; - const totalTests = TEST_CONFIG.entityCounts.length; - - // 运行不同规模的测试 - for (let i = 0; i < TEST_CONFIG.entityCounts.length; i++) { - const entityCount = TEST_CONFIG.entityCounts[i]; - console.log(`\n🔄 进度: ${i + 1}/${totalTests} (${((i + 1) / totalTests * 100).toFixed(1)}%)`); - - const result = runPerformanceTest(scene, entityCount, TEST_CONFIG); - results.push(result); - - // 清理场景,准备下一轮测试 - console.log(` 🧹 清理内存...`); - scene.end(); - scene.begin(); - - // 强制垃圾回收 - if (typeof global !== 'undefined' && global.gc) { - global.gc(); - } - - // 大规模测试间隔稍作休息 - if (entityCount >= 100000) { - console.log(` ⏱️ 等待系统稳定...`); - await new Promise(resolve => setTimeout(resolve, 2000)); - } - } - - displayResults(results, scene); - - scene.end(); - console.log('\n✅ 性能测试完成!'); - console.log(`📊 总测试时间: ${((Date.now() - startTime) / 1000 / 60).toFixed(1)} 分钟`); -} - -// 记录开始时间 -const startTime = Date.now(); - -// 运行测试 -runBenchmarks().catch(error => { - console.error('❌ 测试失败:', error); -}); \ No newline at end of file diff --git a/src/Testing/Performance/component-performance.js b/src/Testing/Performance/component-performance.js deleted file mode 100644 index 8cfdf7eb..00000000 --- a/src/Testing/Performance/component-performance.js +++ /dev/null @@ -1,53 +0,0 @@ -const { Scene } = require('./bin/ECS/Scene.js'); - -const { Component } = require('./bin/ECS/Component.js'); - -// 简单的组件类 -class TestComponent extends Component { - constructor(value) { - super(); - this.value = value; - } -} - -console.log('🔬 组件添加性能分析'); - -// 创建场景和实体 -const scene = new Scene(); -console.log('✅ 创建场景完成'); - -const startCreate = performance.now(); -const entities = scene.createEntities(5000, 'TestEntity'); -const endCreate = performance.now(); - -console.log(`✅ 创建了 ${entities.length} 个实体,耗时: ${(endCreate - startCreate).toFixed(2)}ms`); - -// 测试单个组件添加性能 -console.log('\n📊 测试组件添加性能:'); - -const startAdd = performance.now(); -for (let i = 0; i < entities.length; i++) { - const entity = entities[i]; - entity.addComponent(new TestComponent(i)); -} -const endAdd = performance.now(); - -const addTime = endAdd - startAdd; -console.log(`添加 ${entities.length} 个组件耗时: ${addTime.toFixed(2)}ms`); -console.log(`平均每个组件: ${(addTime / entities.length).toFixed(4)}ms`); -console.log(`添加速度: ${(entities.length / (addTime / 1000)).toFixed(0)} 组件/秒`); - -// 测试组件获取性能 -console.log('\n📊 测试组件获取性能:'); - -const startGet = performance.now(); -for (let i = 0; i < entities.length; i++) { - const entity = entities[i]; - const component = entity.getComponent(TestComponent); -} -const endGet = performance.now(); - -const getTime = endGet - startGet; -console.log(`获取 ${entities.length} 个组件耗时: ${getTime.toFixed(2)}ms`); -console.log(`平均每个组件: ${(getTime / entities.length).toFixed(4)}ms`); -console.log(`获取速度: ${(entities.length / (getTime / 1000)).toFixed(0)} 组件/秒`); \ No newline at end of file diff --git a/src/Testing/Unit/bitmask-optimizer.test.ts b/src/Testing/Unit/bitmask-optimizer.test.ts deleted file mode 100644 index d5c5acbe..00000000 --- a/src/Testing/Unit/bitmask-optimizer.test.ts +++ /dev/null @@ -1,199 +0,0 @@ -import { BitMaskOptimizer } from '../../ECS/Core/BitMaskOptimizer'; - -/** - * 位掩码优化器测试 - */ -function testBitMaskOptimizer(): void { - console.log('🧪 测试位掩码优化器'); - - const optimizer = BitMaskOptimizer.getInstance(); - optimizer.reset(); - - // 测试组件类型注册 - console.log(' 📝 测试组件类型注册...'); - const positionId = optimizer.registerComponentType('Position'); - const velocityId = optimizer.registerComponentType('Velocity'); - const healthId = optimizer.registerComponentType('Health'); - - console.log(` Position ID: ${positionId}`); - console.log(` Velocity ID: ${velocityId}`); - console.log(` Health ID: ${healthId}`); - - // 测试单个组件掩码 - console.log(' 🎯 测试单个组件掩码...'); - const positionMask = optimizer.createSingleComponentMask('Position'); - const velocityMask = optimizer.createSingleComponentMask('Velocity'); - - console.log(` Position掩码: ${positionMask.toString(2)}`); - console.log(` Velocity掩码: ${velocityMask.toString(2)}`); - - // 测试组合掩码 - console.log(' 🔗 测试组合掩码...'); - const combinedMask = optimizer.createCombinedMask(['Position', 'Velocity']); - console.log(` Position+Velocity掩码: ${combinedMask.toString(2)}`); - - // 测试掩码包含检查 - console.log(' ✅ 测试掩码包含检查...'); - const hasPosition = optimizer.maskContainsComponent(combinedMask, 'Position'); - const hasVelocity = optimizer.maskContainsComponent(combinedMask, 'Velocity'); - const hasHealth = optimizer.maskContainsComponent(combinedMask, 'Health'); - - console.log(` 包含Position: ${hasPosition}`); - console.log(` 包含Velocity: ${hasVelocity}`); - console.log(` 包含Health: ${hasHealth}`); - - // 测试掩码操作 - console.log(' 🔧 测试掩码操作...'); - let entityMask = 0n; - entityMask = optimizer.addComponentToMask(entityMask, 'Position'); - entityMask = optimizer.addComponentToMask(entityMask, 'Health'); - - console.log(` 添加Position和Health后: ${entityMask.toString(2)}`); - - const hasAll = optimizer.maskContainsAllComponents(entityMask, ['Position', 'Health']); - const hasAny = optimizer.maskContainsAnyComponent(entityMask, ['Position', 'Velocity']); - - console.log(` 包含Position和Health: ${hasAll}`); - console.log(` 包含Position或Velocity: ${hasAny}`); - - // 测试掩码分析 - console.log(' 📊 测试掩码分析...'); - const componentNames = optimizer.maskToComponentNames(entityMask); - const componentCount = optimizer.getComponentCount(entityMask); - - console.log(` 掩码包含的组件: ${componentNames.join(', ')}`); - console.log(` 组件数量: ${componentCount}`); - - // 测试缓存统计 - console.log(' 📈 测试缓存统计...'); - const stats = optimizer.getCacheStats(); - console.log(` 缓存大小: ${stats.size}`); - console.log(` 组件类型数量: ${stats.componentTypes}`); - - // 测试预计算常用掩码 - console.log(' ⚡ 测试预计算常用掩码...'); - const commonCombinations = [ - ['Position', 'Velocity'], - ['Position', 'Health'], - ['Position', 'Velocity', 'Health'] - ]; - - optimizer.precomputeCommonMasks(commonCombinations); - const statsAfterPrecompute = optimizer.getCacheStats(); - console.log(` 预计算后缓存大小: ${statsAfterPrecompute.size}`); - - console.log('✅ 位掩码优化器测试完成'); -} - -/** - * 性能测试 - */ -function testBitMaskPerformance(): void { - console.log('\n🚀 位掩码优化器性能测试'); - - const optimizer = BitMaskOptimizer.getInstance(); - optimizer.reset(); - - // 注册组件类型 - const componentTypes = ['Position', 'Velocity', 'Health', 'Render', 'AI', 'Physics', 'Audio', 'Network']; - for (const type of componentTypes) { - optimizer.registerComponentType(type); - } - - const iterations = 100000; - - // 测试单个掩码创建性能 - console.log(' 🔥 测试单个掩码创建性能...'); - let start = performance.now(); - for (let i = 0; i < iterations; i++) { - optimizer.createSingleComponentMask('Position'); - } - let end = performance.now(); - console.log(` ${iterations}次单个掩码创建: ${(end - start).toFixed(2)}ms`); - - // 测试组合掩码创建性能 - console.log(' 🔥 测试组合掩码创建性能...'); - start = performance.now(); - for (let i = 0; i < iterations; i++) { - optimizer.createCombinedMask(['Position', 'Velocity', 'Health']); - } - end = performance.now(); - console.log(` ${iterations}次组合掩码创建: ${(end - start).toFixed(2)}ms`); - - // 测试掩码检查性能 - console.log(' 🔥 测试掩码检查性能...'); - const testMask = optimizer.createCombinedMask(['Position', 'Velocity', 'Health']); - - start = performance.now(); - for (let i = 0; i < iterations; i++) { - optimizer.maskContainsComponent(testMask, 'Position'); - optimizer.maskContainsComponent(testMask, 'AI'); - } - end = performance.now(); - console.log(` ${iterations * 2}次掩码检查: ${(end - start).toFixed(2)}ms`); - - // 对比原生位操作性能 - console.log(' ⚖️ 对比原生位操作性能...'); - const positionBit = 1n << 0n; - const velocityBit = 1n << 1n; - const healthBit = 1n << 2n; - const nativeMask = positionBit | velocityBit | healthBit; - - start = performance.now(); - for (let i = 0; i < iterations; i++) { - (nativeMask & positionBit) !== 0n; - (nativeMask & (1n << 7n)) !== 0n; // AI位 - } - end = performance.now(); - console.log(` ${iterations * 2}次原生位操作: ${(end - start).toFixed(2)}ms`); - - console.log('✅ 性能测试完成'); -} - -/** - * 内存使用测试 - */ -function testBitMaskMemoryUsage(): void { - console.log('\n💾 位掩码优化器内存使用测试'); - - const optimizer = BitMaskOptimizer.getInstance(); - optimizer.reset(); - - // 注册大量组件类型 - console.log(' 📝 注册组件类型...'); - for (let i = 0; i < 100; i++) { - optimizer.registerComponentType(`Component${i}`); - } - - // 创建大量掩码组合 - console.log(' 🔗 创建掩码组合...'); - const maskCount = 1000; - for (let i = 0; i < maskCount; i++) { - const componentCount = Math.floor(Math.random() * 5) + 1; - const components: string[] = []; - for (let j = 0; j < componentCount; j++) { - components.push(`Component${Math.floor(Math.random() * 100)}`); - } - optimizer.createCombinedMask(components); - } - - const stats = optimizer.getCacheStats(); - console.log(` 📊 最终统计:`); - console.log(` 组件类型数量: ${stats.componentTypes}`); - console.log(` 缓存掩码数量: ${stats.size}`); - console.log(` 平均每个掩码占用: ~${(stats.size * 64 / 1024).toFixed(2)} KB`); - - console.log('✅ 内存使用测试完成'); -} - -// 运行所有测试 -export function runBitMaskOptimizerTests(): void { - console.log('🧪 位掩码优化器测试套件'); - console.log('='.repeat(50)); - - testBitMaskOptimizer(); - testBitMaskPerformance(); - testBitMaskMemoryUsage(); - - console.log('\n✅ 所有测试完成'); -} \ No newline at end of file diff --git a/src/Testing/Unit/component-pool.test.ts b/src/Testing/Unit/component-pool.test.ts deleted file mode 100644 index a0b841f6..00000000 --- a/src/Testing/Unit/component-pool.test.ts +++ /dev/null @@ -1,189 +0,0 @@ -import { ComponentPool, ComponentPoolManager } from '../../ECS/Core/ComponentPool'; -import { Component } from '../../ECS/Component'; - -/** - * 测试用组件 - */ -class TestComponent extends Component { - public value: number = 0; - - constructor(value: number = 0) { - super(); - this.value = value; - } - - reset(): void { - this.value = 0; - } -} - -/** - * 运行组件对象池测试 - */ -export function runComponentPoolTests(): void { - console.log('🧪 组件对象池测试'); - console.log('='.repeat(50)); - - testBasicFunctionality(); - testPoolManager(); - testPerformance(); - - console.log('✅ 组件对象池测试完成'); -} - -/** - * 基础功能测试 - */ -function testBasicFunctionality(): void { - console.log('\n📝 基础功能测试...'); - - const pool = new ComponentPool( - () => new TestComponent(), - (component) => component.reset(), - 10 - ); - - // 测试获取新组件实例 - console.log(' 测试获取新组件实例...'); - const component = pool.acquire(); - console.assert(component instanceof TestComponent, '应该返回TestComponent实例'); - console.assert(component.value === 0, '新组件的值应该为0'); - - // 测试释放和复用 - console.log(' 测试组件释放和复用...'); - component.value = 42; - pool.release(component); - console.assert(pool.getAvailableCount() === 1, '池中应该有1个可用组件'); - - const reusedComponent = pool.acquire(); - console.assert(reusedComponent === component, '应该复用同一个组件实例'); - console.assert(reusedComponent.value === 0, '复用的组件应该被重置'); - - // 测试预填充 - console.log(' 测试对象池预填充...'); - pool.prewarm(5); - console.assert(pool.getAvailableCount() === 5, '预填充后应该有5个可用组件'); - - const components: TestComponent[] = []; - for (let i = 0; i < 5; i++) { - components.push(pool.acquire()); - } - console.assert(pool.getAvailableCount() === 0, '获取5个组件后池应该为空'); - - // 测试最大容量限制 - console.log(' 测试最大容量限制...'); - pool.prewarm(10); - const extraComponent = new TestComponent(); - pool.release(extraComponent); - console.assert(pool.getAvailableCount() === 10, '不应该超过最大容量'); - - // 测试清空池 - console.log(' 测试清空对象池...'); - pool.clear(); - console.assert(pool.getAvailableCount() === 0, '清空后池应该为空'); - - console.log(' ✅ 基础功能测试通过'); -} - -/** - * 池管理器测试 - */ -function testPoolManager(): void { - console.log('\n📝 池管理器测试...'); - - const manager = ComponentPoolManager.getInstance(); - manager.clearAll(); - - // 测试单例模式 - console.log(' 测试单例模式...'); - const manager1 = ComponentPoolManager.getInstance(); - const manager2 = ComponentPoolManager.getInstance(); - console.assert(manager1 === manager2, '应该返回同一个实例'); - - // 测试注册组件池 - console.log(' 测试注册组件池...'); - manager.registerPool( - 'TestComponent', - () => new TestComponent(), - (component) => component.reset(), - 5 - ); - - const stats = manager.getPoolStats(); - console.assert(stats.has('TestComponent'), '应该包含已注册的组件类型'); - console.assert(stats.get('TestComponent')?.maxSize === 5, '最大容量应该为5'); - - // 测试获取和释放组件 - console.log(' 测试获取和释放组件...'); - const component = manager.acquireComponent('TestComponent'); - console.assert(component instanceof TestComponent, '应该返回TestComponent实例'); - - if (component) { - component.value = 42; - manager.releaseComponent('TestComponent', component); - - const reusedComponent = manager.acquireComponent('TestComponent'); - console.assert(reusedComponent === component, '应该复用同一个组件'); - console.assert(reusedComponent?.value === 0, '复用的组件应该被重置'); - } - - // 测试预热所有池 - console.log(' 测试预热所有池...'); - manager.registerPool('TestComponent1', () => new TestComponent()); - manager.registerPool('TestComponent2', () => new TestComponent()); - - manager.prewarmAll(3); - - const finalStats = manager.getPoolStats(); - console.assert(finalStats.get('TestComponent1')?.available === 3, 'TestComponent1应该有3个可用组件'); - console.assert(finalStats.get('TestComponent2')?.available === 3, 'TestComponent2应该有3个可用组件'); - - // 测试未注册的组件类型 - console.log(' 测试未注册的组件类型...'); - const nullComponent = manager.acquireComponent('NonExistentComponent'); - console.assert(nullComponent === null, '未注册的组件类型应该返回null'); - - manager.clearAll(); - console.log(' ✅ 池管理器测试通过'); -} - -/** - * 性能测试 - */ -function testPerformance(): void { - console.log('\n📝 性能测试...'); - - const pool = new ComponentPool(() => new TestComponent()); - const iterations = 10000; - - // 预热池 - pool.prewarm(100); - - // 测试对象池性能 - const poolStart = performance.now(); - for (let i = 0; i < iterations; i++) { - const component = pool.acquire(); - pool.release(component); - } - const poolEnd = performance.now(); - const poolTime = poolEnd - poolStart; - - // 测试直接创建性能 - const directStart = performance.now(); - for (let i = 0; i < iterations; i++) { - new TestComponent(); - } - const directEnd = performance.now(); - const directTime = directEnd - directStart; - - console.log(` 对象池时间: ${poolTime.toFixed(2)}ms`); - console.log(` 直接创建时间: ${directTime.toFixed(2)}ms`); - const improvement = ((directTime - poolTime) / directTime * 100); - console.log(` 性能提升: ${improvement.toFixed(1)}%`); - - if (poolTime < directTime) { - console.log(' ✅ 对象池性能测试通过 - 比直接创建更快'); - } else { - console.log(' ⚠️ 对象池在小规模测试中可能不如直接创建快'); - } -} \ No newline at end of file diff --git a/src/Testing/test-runner.ts b/src/Testing/test-runner.ts deleted file mode 100644 index 7970e6b9..00000000 --- a/src/Testing/test-runner.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { runBitMaskOptimizerTests } from './Unit/bitmask-optimizer.test'; -import { runComponentPoolTests } from './Unit/component-pool.test'; - -/** - * 测试运行器 - 统一运行所有测试 - */ -export class TestRunner { - private results: Map = new Map(); - - /** - * 运行所有单元测试 - */ - async runUnitTests(): Promise { - console.log('🧪 运行单元测试'); - console.log('='.repeat(50)); - - await this.runTest('组件对象池', runComponentPoolTests); - await this.runTest('位掩码优化器', runBitMaskOptimizerTests); - - console.log('\n📊 单元测试总结:'); - this.printSummary(); - } - - /** - * 运行性能测试 - */ - async runPerformanceTests(): Promise { - console.log('\n🚀 运行性能测试'); - console.log('='.repeat(50)); - - // 性能测试需要从benchmark.ts文件中导入 - console.log('⚠️ 性能测试需要单独运行 - 请使用: node benchmark.ts'); - - console.log('\n📊 性能测试总结:'); - this.printSummary(); - } - - /** - * 运行集成测试 - */ - async runIntegrationTests(): Promise { - console.log('\n🔗 运行集成测试'); - console.log('='.repeat(50)); - - // 集成测试待实现 - console.log('⚠️ 集成测试尚未实现'); - } - - /** - * 运行所有测试 - */ - async runAllTests(): Promise { - console.log('🎯 ECS框架完整测试套件'); - console.log('='.repeat(60)); - - const startTime = performance.now(); - - await this.runUnitTests(); - await this.runPerformanceTests(); - await this.runIntegrationTests(); - - const endTime = performance.now(); - const totalDuration = endTime - startTime; - - console.log('\n✅ 所有测试完成'); - console.log(`🕐 总测试时间: ${(totalDuration / 1000).toFixed(2)}秒`); - - this.printFinalSummary(); - } - - /** - * 运行单个测试 - */ - private async runTest(testName: string, testFunction: () => void | Promise): Promise { - console.log(`\n▶️ 开始测试: ${testName}`); - - const startTime = performance.now(); - let passed = 0; - let failed = 0; - - try { - await testFunction(); - passed = 1; - console.log(`✅ ${testName} 测试通过`); - } catch (error) { - failed = 1; - console.error(`❌ ${testName} 测试失败:`, error); - } - - const endTime = performance.now(); - const duration = endTime - startTime; - - this.results.set(testName, { passed, failed, duration }); - - console.log(`⏱️ 耗时: ${duration.toFixed(2)}ms`); - } - - /** - * 打印测试摘要 - */ - private printSummary(): void { - let totalPassed = 0; - let totalFailed = 0; - let totalDuration = 0; - - for (const [name, result] of this.results) { - totalPassed += result.passed; - totalFailed += result.failed; - totalDuration += result.duration; - - const status = result.failed > 0 ? '❌' : '✅'; - console.log(` ${status} ${name}: ${result.duration.toFixed(2)}ms`); - } - - console.log(`\n📈 测试统计:`); - console.log(` 通过: ${totalPassed}`); - console.log(` 失败: ${totalFailed}`); - console.log(` 总时间: ${totalDuration.toFixed(2)}ms`); - console.log(` 成功率: ${totalPassed + totalFailed > 0 ? (totalPassed / (totalPassed + totalFailed) * 100).toFixed(1) : 0}%`); - } - - /** - * 打印最终测试摘要 - */ - private printFinalSummary(): void { - console.log('\n📋 最终测试报告'); - console.log('='.repeat(60)); - - let totalPassed = 0; - let totalFailed = 0; - - for (const [, result] of this.results) { - totalPassed += result.passed; - totalFailed += result.failed; - } - - if (totalFailed === 0) { - console.log('🎉 所有测试都通过了!'); - } else { - console.log(`⚠️ 有 ${totalFailed} 个测试失败`); - } - - console.log(`📊 测试覆盖率: ${this.results.size} 个测试模块`); - console.log(`✅ 通过率: ${totalPassed + totalFailed > 0 ? (totalPassed / (totalPassed + totalFailed) * 100).toFixed(1) : 0}%`); - } - - /** - * 清除测试结果 - */ - clearResults(): void { - this.results.clear(); - } -} - -/** - * 便捷函数:运行所有测试 - */ -export async function runAllTests(): Promise { - const runner = new TestRunner(); - await runner.runAllTests(); -} - -/** - * 便捷函数:仅运行单元测试 - */ -export async function runUnitTests(): Promise { - const runner = new TestRunner(); - await runner.runUnitTests(); -} - -/** - * 便捷函数:仅运行性能测试 - */ -export async function runPerformanceTests(): Promise { - const runner = new TestRunner(); - await runner.runPerformanceTests(); -} - -// 如果直接运行此文件,执行所有测试 -if (require.main === module) { - runAllTests().catch(console.error); -} \ No newline at end of file diff --git a/src/Utils/WasmCore.ts b/src/Utils/WasmCore.ts deleted file mode 100644 index c71cf6d4..00000000 --- a/src/Utils/WasmCore.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * WASM ECS核心模块 - * - * 提供高性能的ECS操作,支持WASM和JavaScript双重实现 - */ - -export * from './Wasm'; -export type Query = import('./Wasm').QueryResult; \ No newline at end of file diff --git a/src/Utils/index.ts b/src/Utils/index.ts index 8979e9e1..2df380ee 100644 --- a/src/Utils/index.ts +++ b/src/Utils/index.ts @@ -3,15 +3,4 @@ export * from './Pool'; export * from './Emitter'; export * from './GlobalManager'; export * from './PerformanceMonitor'; -export { Time } from './Time'; -export { - WasmEcsCore, - ecsCore, - initializeEcs, - EntityId, - ComponentMask, - QueryResult, - PerformanceStats as WasmPerformanceStats, - WasmLoader, - JavaScriptFallback -} from './Wasm'; \ No newline at end of file +export { Time } from './Time'; \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 3d5fb10e..51658b56 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -38,7 +38,6 @@ "exclude": [ "node_modules", "bin", - "src/wasm/**/*", "**/*.test.ts", "**/*.spec.ts" ] diff --git a/wasm-release/README.md b/wasm-release/README.md deleted file mode 100644 index c965f284..00000000 --- a/wasm-release/README.md +++ /dev/null @@ -1,95 +0,0 @@ -# ECS Framework WASM 支持包 - -这个包包含了 @esengine/ecs-framework 的 WASM 加速模块。 - -## 包含文件 - -- `ecs_wasm_core.js` - WASM 胶水代码 -- `ecs_wasm_core.d.ts` - TypeScript 类型定义 -- `ecs_wasm_core_bg.wasm` - WASM 二进制文件 -- `ecs_wasm_core_bg.wasm.d.ts` - WASM 类型定义 -- `package.json` - 包信息 - -## 使用方法 - -### Node.js 环境 - -```javascript -import init, { EcsCore } from './ecs_wasm_core.js'; - -async function useWasm() { - // 初始化 WASM 模块 - await init(); - - // 创建 ECS 核心实例 - const ecsCore = new EcsCore(); - - // 使用 WASM 加速的 ECS 功能 - const entity = ecsCore.create_entity(); - console.log('创建实体:', entity); -} - -useWasm(); -``` - -### 浏览器环境 - -```html - - - - - - -

ECS Framework WASM Demo

- - -``` - -### TypeScript 支持 - -确保包含类型定义: - -```typescript -import init, { EcsCore } from './ecs_wasm_core.js'; - -async function typedExample(): Promise { - await init(); - - const ecsCore = new EcsCore(); - const entityId: number = ecsCore.create_entity(); - - // 使用类型安全的 API - const mask = BigInt(0b1010); - ecsCore.update_entity_mask(entityId, mask); -} -``` - -## 性能优势 - -WASM 模块主要优化以下操作: - -- 🚀 实体查询(10-100x 性能提升) -- 🔥 组件掩码操作 -- ⚡ 批量实体处理 - -## 兼容性 - -- **浏览器**: 支持 WebAssembly 的现代浏览器 -- **Node.js**: 16.0+ 版本 -- **TypeScript**: 4.0+ 版本 - -## 许可证 - -MIT License - 详见 LICENSE 文件 diff --git a/wasm-release/ecs_wasm_core.d.ts b/wasm-release/ecs_wasm_core.d.ts deleted file mode 100644 index 8f869281..00000000 --- a/wasm-release/ecs_wasm_core.d.ts +++ /dev/null @@ -1,141 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * 创建组件掩码的辅助函数 - */ -export function create_component_mask(component_ids: Uint32Array): bigint; -/** - * 检查掩码是否包含指定组件 - */ -export function mask_contains_component(mask: bigint, component_id: number): boolean; -/** - * 初始化函数 - */ -export function main(): void; -/** - * 高性能ECS核心,专注于实体查询和掩码管理 - */ -export class EcsCore { - free(): void; - /** - * 创建新的ECS核心 - */ - constructor(); - /** - * 创建新实体 - */ - create_entity(): number; - /** - * 删除实体 - */ - destroy_entity(entity_id: number): boolean; - /** - * 更新实体的组件掩码 - */ - update_entity_mask(entity_id: number, mask: bigint): void; - /** - * 批量更新实体掩码 - */ - batch_update_masks(entity_ids: Uint32Array, masks: BigUint64Array): void; - /** - * 查询实体 - */ - query_entities(mask: bigint, max_results: number): number; - /** - * 获取查询结果数量 - */ - get_query_result_count(): number; - /** - * 缓存查询实体 - */ - query_cached(mask: bigint): number; - /** - * 获取缓存查询结果数量 - */ - get_cached_query_count(mask: bigint): number; - /** - * 多组件查询 - */ - query_multiple_components(masks: BigUint64Array, max_results: number): number; - /** - * 排除查询 - */ - query_with_exclusion(include_mask: bigint, exclude_mask: bigint, max_results: number): number; - /** - * 获取实体的组件掩码 - */ - get_entity_mask(entity_id: number): bigint; - /** - * 检查实体是否存在 - */ - entity_exists(entity_id: number): boolean; - /** - * 获取实体数量 - */ - get_entity_count(): number; - /** - * 获取性能统计信息 - */ - get_performance_stats(): Array; - /** - * 清理所有数据 - */ - clear(): void; - /** - * 重建查询缓存 - */ - rebuild_query_cache(): void; -} - -export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; - -export interface InitOutput { - readonly memory: WebAssembly.Memory; - readonly __wbg_ecscore_free: (a: number, b: number) => void; - readonly ecscore_new: () => number; - readonly ecscore_create_entity: (a: number) => number; - readonly ecscore_destroy_entity: (a: number, b: number) => number; - readonly ecscore_update_entity_mask: (a: number, b: number, c: bigint) => void; - readonly ecscore_batch_update_masks: (a: number, b: number, c: number, d: number, e: number) => void; - readonly ecscore_query_entities: (a: number, b: bigint, c: number) => number; - readonly ecscore_get_query_result_count: (a: number) => number; - readonly ecscore_query_cached: (a: number, b: bigint) => number; - readonly ecscore_get_cached_query_count: (a: number, b: bigint) => number; - readonly ecscore_query_multiple_components: (a: number, b: number, c: number, d: number) => number; - readonly ecscore_query_with_exclusion: (a: number, b: bigint, c: bigint, d: number) => number; - readonly ecscore_get_entity_mask: (a: number, b: number) => bigint; - readonly ecscore_entity_exists: (a: number, b: number) => number; - readonly ecscore_get_entity_count: (a: number) => number; - readonly ecscore_get_performance_stats: (a: number) => any; - readonly ecscore_clear: (a: number) => void; - readonly ecscore_rebuild_query_cache: (a: number) => void; - readonly create_component_mask: (a: number, b: number) => bigint; - readonly mask_contains_component: (a: bigint, b: number) => number; - readonly main: () => void; - readonly __wbindgen_exn_store: (a: number) => void; - readonly __externref_table_alloc: () => number; - readonly __wbindgen_export_2: WebAssembly.Table; - readonly __wbindgen_malloc: (a: number, b: number) => number; - readonly __wbindgen_start: () => void; -} - -export type SyncInitInput = BufferSource | WebAssembly.Module; -/** -* Instantiates the given `module`, which can either be bytes or -* a precompiled `WebAssembly.Module`. -* -* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. -* -* @returns {InitOutput} -*/ -export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; - -/** -* If `module_or_path` is {RequestInfo} or {URL}, makes a request and -* for everything else, calls `WebAssembly.instantiate` directly. -* -* @param {{ module_or_path: InitInput | Promise }} module_or_path - Passing `InitInput` directly is deprecated. -* -* @returns {Promise} -*/ -export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise } | InitInput | Promise): Promise; diff --git a/wasm-release/ecs_wasm_core.js b/wasm-release/ecs_wasm_core.js deleted file mode 100644 index cdb1b1b5..00000000 --- a/wasm-release/ecs_wasm_core.js +++ /dev/null @@ -1,415 +0,0 @@ -let wasm; - -let cachedUint8ArrayMemory0 = null; - -function getUint8ArrayMemory0() { - if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { - cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); - } - return cachedUint8ArrayMemory0; -} - -function getArrayU8FromWasm0(ptr, len) { - ptr = ptr >>> 0; - return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); -} - -function addToExternrefTable0(obj) { - const idx = wasm.__externref_table_alloc(); - wasm.__wbindgen_export_2.set(idx, obj); - return idx; -} - -function handleError(f, args) { - try { - return f.apply(this, args); - } catch (e) { - const idx = addToExternrefTable0(e); - wasm.__wbindgen_exn_store(idx); - } -} - -const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); - -if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; - -function getStringFromWasm0(ptr, len) { - ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); -} - -let cachedUint32ArrayMemory0 = null; - -function getUint32ArrayMemory0() { - if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) { - cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer); - } - return cachedUint32ArrayMemory0; -} - -let WASM_VECTOR_LEN = 0; - -function passArray32ToWasm0(arg, malloc) { - const ptr = malloc(arg.length * 4, 4) >>> 0; - getUint32ArrayMemory0().set(arg, ptr / 4); - WASM_VECTOR_LEN = arg.length; - return ptr; -} - -let cachedBigUint64ArrayMemory0 = null; - -function getBigUint64ArrayMemory0() { - if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) { - cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer); - } - return cachedBigUint64ArrayMemory0; -} - -function passArray64ToWasm0(arg, malloc) { - const ptr = malloc(arg.length * 8, 8) >>> 0; - getBigUint64ArrayMemory0().set(arg, ptr / 8); - WASM_VECTOR_LEN = arg.length; - return ptr; -} -/** - * 创建组件掩码的辅助函数 - * @param {Uint32Array} component_ids - * @returns {bigint} - */ -export function create_component_mask(component_ids) { - const ptr0 = passArray32ToWasm0(component_ids, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ret = wasm.create_component_mask(ptr0, len0); - return BigInt.asUintN(64, ret); -} - -/** - * 检查掩码是否包含指定组件 - * @param {bigint} mask - * @param {number} component_id - * @returns {boolean} - */ -export function mask_contains_component(mask, component_id) { - const ret = wasm.mask_contains_component(mask, component_id); - return ret !== 0; -} - -/** - * 初始化函数 - */ -export function main() { - wasm.main(); -} - -const EcsCoreFinalization = (typeof FinalizationRegistry === 'undefined') - ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_ecscore_free(ptr >>> 0, 1)); -/** - * 高性能ECS核心,专注于实体查询和掩码管理 - */ -export class EcsCore { - - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - EcsCoreFinalization.unregister(this); - return ptr; - } - - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_ecscore_free(ptr, 0); - } - /** - * 创建新的ECS核心 - */ - constructor() { - const ret = wasm.ecscore_new(); - this.__wbg_ptr = ret >>> 0; - EcsCoreFinalization.register(this, this.__wbg_ptr, this); - return this; - } - /** - * 创建新实体 - * @returns {number} - */ - create_entity() { - const ret = wasm.ecscore_create_entity(this.__wbg_ptr); - return ret >>> 0; - } - /** - * 删除实体 - * @param {number} entity_id - * @returns {boolean} - */ - destroy_entity(entity_id) { - const ret = wasm.ecscore_destroy_entity(this.__wbg_ptr, entity_id); - return ret !== 0; - } - /** - * 更新实体的组件掩码 - * @param {number} entity_id - * @param {bigint} mask - */ - update_entity_mask(entity_id, mask) { - wasm.ecscore_update_entity_mask(this.__wbg_ptr, entity_id, mask); - } - /** - * 批量更新实体掩码 - * @param {Uint32Array} entity_ids - * @param {BigUint64Array} masks - */ - batch_update_masks(entity_ids, masks) { - const ptr0 = passArray32ToWasm0(entity_ids, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray64ToWasm0(masks, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - wasm.ecscore_batch_update_masks(this.__wbg_ptr, ptr0, len0, ptr1, len1); - } - /** - * 查询实体 - * @param {bigint} mask - * @param {number} max_results - * @returns {number} - */ - query_entities(mask, max_results) { - const ret = wasm.ecscore_query_entities(this.__wbg_ptr, mask, max_results); - return ret >>> 0; - } - /** - * 获取查询结果数量 - * @returns {number} - */ - get_query_result_count() { - const ret = wasm.ecscore_get_query_result_count(this.__wbg_ptr); - return ret >>> 0; - } - /** - * 缓存查询实体 - * @param {bigint} mask - * @returns {number} - */ - query_cached(mask) { - const ret = wasm.ecscore_query_cached(this.__wbg_ptr, mask); - return ret >>> 0; - } - /** - * 获取缓存查询结果数量 - * @param {bigint} mask - * @returns {number} - */ - get_cached_query_count(mask) { - const ret = wasm.ecscore_get_cached_query_count(this.__wbg_ptr, mask); - return ret >>> 0; - } - /** - * 多组件查询 - * @param {BigUint64Array} masks - * @param {number} max_results - * @returns {number} - */ - query_multiple_components(masks, max_results) { - const ptr0 = passArray64ToWasm0(masks, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ret = wasm.ecscore_query_multiple_components(this.__wbg_ptr, ptr0, len0, max_results); - return ret >>> 0; - } - /** - * 排除查询 - * @param {bigint} include_mask - * @param {bigint} exclude_mask - * @param {number} max_results - * @returns {number} - */ - query_with_exclusion(include_mask, exclude_mask, max_results) { - const ret = wasm.ecscore_query_with_exclusion(this.__wbg_ptr, include_mask, exclude_mask, max_results); - return ret >>> 0; - } - /** - * 获取实体的组件掩码 - * @param {number} entity_id - * @returns {bigint} - */ - get_entity_mask(entity_id) { - const ret = wasm.ecscore_get_entity_mask(this.__wbg_ptr, entity_id); - return BigInt.asUintN(64, ret); - } - /** - * 检查实体是否存在 - * @param {number} entity_id - * @returns {boolean} - */ - entity_exists(entity_id) { - const ret = wasm.ecscore_entity_exists(this.__wbg_ptr, entity_id); - return ret !== 0; - } - /** - * 获取实体数量 - * @returns {number} - */ - get_entity_count() { - const ret = wasm.ecscore_get_entity_count(this.__wbg_ptr); - return ret >>> 0; - } - /** - * 获取性能统计信息 - * @returns {Array} - */ - get_performance_stats() { - const ret = wasm.ecscore_get_performance_stats(this.__wbg_ptr); - return ret; - } - /** - * 清理所有数据 - */ - clear() { - wasm.ecscore_clear(this.__wbg_ptr); - } - /** - * 重建查询缓存 - */ - rebuild_query_cache() { - wasm.ecscore_rebuild_query_cache(this.__wbg_ptr); - } -} - -async function __wbg_load(module, imports) { - if (typeof Response === 'function' && module instanceof Response) { - if (typeof WebAssembly.instantiateStreaming === 'function') { - try { - return await WebAssembly.instantiateStreaming(module, imports); - - } catch (e) { - if (module.headers.get('Content-Type') != 'application/wasm') { - console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - - } else { - throw e; - } - } - } - - const bytes = await module.arrayBuffer(); - return await WebAssembly.instantiate(bytes, imports); - - } else { - const instance = await WebAssembly.instantiate(module, imports); - - if (instance instanceof WebAssembly.Instance) { - return { instance, module }; - - } else { - return instance; - } - } -} - -function __wbg_get_imports() { - const imports = {}; - imports.wbg = {}; - imports.wbg.__wbg_getRandomValues_3c9c0d586e575a16 = function() { return handleError(function (arg0, arg1) { - globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1)); - }, arguments) }; - imports.wbg.__wbg_log_bb5387ff27ac9b37 = function(arg0, arg1) { - console.log(getStringFromWasm0(arg0, arg1)); - }; - imports.wbg.__wbg_new_78feb108b6472713 = function() { - const ret = new Array(); - return ret; - }; - imports.wbg.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) { - const ret = arg0.push(arg1); - return ret; - }; - imports.wbg.__wbindgen_init_externref_table = function() { - const table = wasm.__wbindgen_export_2; - const offset = table.grow(4); - table.set(0, undefined); - table.set(offset + 0, undefined); - table.set(offset + 1, null); - table.set(offset + 2, true); - table.set(offset + 3, false); - ; - }; - imports.wbg.__wbindgen_number_new = function(arg0) { - const ret = arg0; - return ret; - }; - imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm0(arg0, arg1)); - }; - - return imports; -} - -function __wbg_init_memory(imports, memory) { - -} - -function __wbg_finalize_init(instance, module) { - wasm = instance.exports; - __wbg_init.__wbindgen_wasm_module = module; - cachedBigUint64ArrayMemory0 = null; - cachedUint32ArrayMemory0 = null; - cachedUint8ArrayMemory0 = null; - - - wasm.__wbindgen_start(); - return wasm; -} - -function initSync(module) { - if (wasm !== undefined) return wasm; - - - if (typeof module !== 'undefined') { - if (Object.getPrototypeOf(module) === Object.prototype) { - ({module} = module) - } else { - console.warn('using deprecated parameters for `initSync()`; pass a single object instead') - } - } - - const imports = __wbg_get_imports(); - - __wbg_init_memory(imports); - - if (!(module instanceof WebAssembly.Module)) { - module = new WebAssembly.Module(module); - } - - const instance = new WebAssembly.Instance(module, imports); - - return __wbg_finalize_init(instance, module); -} - -async function __wbg_init(module_or_path) { - if (wasm !== undefined) return wasm; - - - if (typeof module_or_path !== 'undefined') { - if (Object.getPrototypeOf(module_or_path) === Object.prototype) { - ({module_or_path} = module_or_path) - } else { - console.warn('using deprecated parameters for the initialization function; pass a single object instead') - } - } - - if (typeof module_or_path === 'undefined') { - module_or_path = new URL('ecs_wasm_core_bg.wasm', import.meta.url); - } - const imports = __wbg_get_imports(); - - if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) { - module_or_path = fetch(module_or_path); - } - - __wbg_init_memory(imports); - - const { instance, module } = await __wbg_load(await module_or_path, imports); - - return __wbg_finalize_init(instance, module); -} - -export { initSync }; -export default __wbg_init; diff --git a/wasm-release/ecs_wasm_core_bg.wasm b/wasm-release/ecs_wasm_core_bg.wasm deleted file mode 100644 index 77cfdc3f68a3a34dbfde29b7d7a4c79664d1fb60..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 59516 zcmeFa3z%G2b?19t^{(!&*4vhBpDK)zY+0^;KP*fi8NV>t#^#NoRb5?e^+VmQ?v`wW zv09c)41r)~7{W(@7;vyjOn|xEgvmHTlQ9gLOTd{S36pUW!@z{^8@}MVLnho{(Ea`Q zKBv06C0TM}efKhhW$Em*&wi}E_S$Q&*WTsS7Wcc3%Jp?-lL~?_+Efxmh>ZkjZ3#z;+mS8>X(to-TejqKKK~VS>0HJSf=sT%PpAFPj`oiB_D!2N7B9^Exgc{O8v^S;#9^!~>FxrMtuXPre#qrO<5 zTWE|V)N))(jKkN%*@rDOV+QdFh94jG}`UDoh`ZhZOQ9e z*ARnRSaKF~+dU_83m3fj;(BrRqQR{jZtH!`Yj1tan_u_(H@xvp2j;KXyY0r>TZ8Dr zf|LKfA9}M7?)1`!JMQ&HB4@kz%qK@GPMcHeDm#Uc_n_?R;gmi5{Ri>)3-#R#-R)kn zGhn$#&gIUR9~n76bfWCk4&N!KLuZF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sj3e}4YaDB`q)rc58};4Z{OIStqEe2owEh)R}ZY6P$L1^`7{i5-`t#d z0y0#0H(E*0(8NRyN#N!E@$gqj!B(=qFcz=nCF9lZT7OqxwJ|o))s0K)npBW`M8 z;MQ*npR?NV$QZ@sWH67QGiQkl>W2s>_lwNOX{mc$%(l+fKVH4|meaRs+nZZJI(d#3 zd+W$HLqlWzV?DL;#$eBNoh_Q4)o`vq@8svb~75)hcENoT&Y;dEO1c&4wC-wXr@3v|eqz z_W3p-nRKXU40FK1P!DE@*FE0``Ub|v>d4kL+_nP~U1P6*z72HYOzwp%V3M^B2hZmtr~7zM0|u%$gsl5?og31qU5Wl+Xg(8Yu~PNY&(Z z|0esK?zsRiF$@dXV4BJTl%1wdj7i8Shw-C@040JK7XtR34O zgp>!+1|`vy2-uBrsaFt_gU2uhKMXCVWSgp8&~m==%vO3qE-2wr7^XPgc6ZQLYX7oY@`F7`NF`Dl zAO}1YC21a=(92_yAuzq~jcZjvDI<`6MMP>OPZ3&Xt%z_(sPFjv#<)i<`g4Hf%n15p z$F+z#)v?I)B$2eJ-~M|)fxWLtosx?bhm`^Q5Ex@7=k-BfovoGIhj0l;8rJ25Tvat7 z{<+e3lFULG==Js?ZkPlXcl?Dz2Vmbc&x_b3g8zv9ir2i>d5b8L!|LK+19{1Hws_}O z=}5ap`f!RixU?|Me$%Ezy=>BXRziD#d`q+p78a-_0u}{Bh%~b>2=C$PYHpffs{!E%5$gT| D6?Y6W diff --git a/wasm-release/ecs_wasm_core_bg.wasm.d.ts b/wasm-release/ecs_wasm_core_bg.wasm.d.ts deleted file mode 100644 index 6b0a5bde..00000000 --- a/wasm-release/ecs_wasm_core_bg.wasm.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export const memory: WebAssembly.Memory; -export const __wbg_ecscore_free: (a: number, b: number) => void; -export const ecscore_new: () => number; -export const ecscore_create_entity: (a: number) => number; -export const ecscore_destroy_entity: (a: number, b: number) => number; -export const ecscore_update_entity_mask: (a: number, b: number, c: bigint) => void; -export const ecscore_batch_update_masks: (a: number, b: number, c: number, d: number, e: number) => void; -export const ecscore_query_entities: (a: number, b: bigint, c: number) => number; -export const ecscore_get_query_result_count: (a: number) => number; -export const ecscore_query_cached: (a: number, b: bigint) => number; -export const ecscore_get_cached_query_count: (a: number, b: bigint) => number; -export const ecscore_query_multiple_components: (a: number, b: number, c: number, d: number) => number; -export const ecscore_query_with_exclusion: (a: number, b: bigint, c: bigint, d: number) => number; -export const ecscore_get_entity_mask: (a: number, b: number) => bigint; -export const ecscore_entity_exists: (a: number, b: number) => number; -export const ecscore_get_entity_count: (a: number) => number; -export const ecscore_get_performance_stats: (a: number) => any; -export const ecscore_clear: (a: number) => void; -export const ecscore_rebuild_query_cache: (a: number) => void; -export const create_component_mask: (a: number, b: number) => bigint; -export const mask_contains_component: (a: bigint, b: number) => number; -export const main: () => void; -export const __wbindgen_exn_store: (a: number) => void; -export const __externref_table_alloc: () => number; -export const __wbindgen_export_2: WebAssembly.Table; -export const __wbindgen_malloc: (a: number, b: number) => number; -export const __wbindgen_start: () => void; diff --git a/wasm-release/package.json b/wasm-release/package.json deleted file mode 100644 index 5f459750..00000000 --- a/wasm-release/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@esengine/ecs-framework-wasm", - "version": "1.0.0", - "description": "ECS Framework WASM 加速模块", - "main": "ecs_wasm_core.js", - "files": [ - "ecs_wasm_core.js", - "ecs_wasm_core_bg.wasm", - "*.d.ts", - "README.md" - ], - "keywords": [ - "ecs", - "wasm", - "game-engine", - "performance" - ], - "author": "ESEngine Team", - "license": "MIT", - "peerDependencies": { - "@esengine/ecs-framework": "^1.0.0" - } -} \ No newline at end of file