perf(ecs): per-frame copies, allocations and WASM crossings in run_systems and the zippers

オープン
#493 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp, wasm

調査の方向性

Read modules/ecs/wasm/Registry.hpp around lines 260–262 and 302–322 to trace run_systems and getZipper. First establish an e2e game performance measurement, since the issue says none has been taken. Compare the per-frame allocations and WASM crossings before and after the proposed caching and length-read changes; done means measured improvement without changing ECS behavior.

索引モデルが issue の本文から書いたものです。

説明

enhancement modules:ecs
Which package or utils is this feature request for?

ecs

Feature

The hottest path breaks the repo's rule against per-frame allocation, at a cost of entities × systems. Every frame copies the systems vector and creates a shared_from_this() JS wrapper per system. Each getZipper builds a std::map, a JS array and one JS object per matching entity, calls get_js_class_name twice per component (3–6 JS property reads each) and re-reads comps["length"] on each iteration. No measurement was taken yet.

Where:

Evidence:

std::vector<emscripten::val> systems_copy = _systems;
for (emscripten::val &system : systems_copy)
    system(shared_from_this(), ctx);
Ideal solution or implementation

Copy the systems only when they change during a run, cache the class-name → array pointer lookup per constructor, and read length once. Measure before and after with the e2e game.

Alternative solutions or implementations

No response

Other context

Found during a code audit of main at be72076.

主要言語
TypeScript
スター
7
フォーク
2
平均マージ
1日 17時間
マージ済み PR(30日)
17

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NanoForge-dev/Engine のほかの issue

NanoForge-dev/Engine の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。