Skip to content

Conversation

@esengine
Copy link
Owner

  • 优化_ensureGenerationCapacity方法以支持Uint16Array扩展
  • 更新_preAllocateGenerations方法使用Uint16Array
  • 优化_isValidId方法使用数组直接访问
  • 更新_calculateMemoryUsage方法计算Uint16Array内存
  • 更新getStats方法中的世代信息统计

- 优化_ensureGenerationCapacity方法以支持Uint16Array扩展
- 更新_preAllocateGenerations方法使用Uint16Array
- 优化_isValidId方法使用数组直接访问
- 更新_calculateMemoryUsage方法计算Uint16Array内存
- 更新getStats方法中的世代信息统计
@esengine esengine changed the title - 修改_generations字段从Map改为Uint16Array 实现更高效的entity-id管理 Jul 19, 2025
@esengine esengine self-assigned this Jul 19, 2025
@esengine esengine added the enhancement New feature or request label Jul 19, 2025
@esengine esengine added this to the Entity重构 milestone Jul 19, 2025
@esengine
Copy link
Owner Author

SIMD 性能优化

  • 传统 AoS:[{x,y,z}, {x,y,z}] → 数据分散,缓存不友好
  • SIMD SoA:{x:[x1,x2,x3], y:[y1,y2,y3]} → 数据连续,支持向量化

TypedArray 优化

  // ComponentStorage.ts:626-655
  getFieldArray(fieldName: string): TypedArray | null
  // 返回 Float32Array、Int32Array 等,支持 SIMD 指令

内存对齐:

 private readonly SIMD_ALIGNMENT = 32; // 32字节对齐

[SIMD优化的SoA布局,提供最佳的数据并行处理性能,使用密集存储和TypedArray来最大化缓存效率和SIMD指令利用率]

优化Entity组件存储结构
添加Entity生命周期钩子
@esengine
Copy link
Owner Author

不合并该分支,版本重构影响太大

@esengine esengine closed this Jul 21, 2025
@esengine esengine deleted the 59-实现更高效的entity-id管理 branch July 21, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

实现更高效的Entity ID管理 优化Entity组件存储结构 添加Entity生命周期钩子

2 participants