perf(graphics-3d): worldToScreen and the render getter allocate on every call

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

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript

調査の方向性

Start with modules/graphics-3d/src/graphics-3d.library.ts at the two cited locations, then read nearby callers to check how worldToScreen results and the render getter are used. The issue proposes a scratch Vector3, a cached default render closure, and an optional output parameter. Confirm the intended API behavior with existing tests or callers, then verify repeated calls avoid the reported allocations and layout reads while preserving results.

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

説明

enhancement modules:graphics-3d
Which package or utils is this feature request for?

graphics-3d

Feature

Each worldToScreen call clones a Vector3, returns a new object and calls getBoundingClientRect(), which can force a layout. The render getter returns a new closure on each access. This matters when called per frame for many entities (HUD labels).

Where:

Evidence:

return this._customRender ?? (() => this._drawDefault());
const ndc = point.clone().project(this.camera);
Ideal solution or implementation

Use a scratch Vector3, cache the default render closure, and take an optional out parameter.

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 を短くまとめたダイジェスト。