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

Aperta
#493 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp, wasm

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
7
Fork
2
Merge medio
1g 17h
PR unite (30g)
17

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NanoForge-dev/Engine

Tutte le issue di NanoForge-dev/Engine

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.