Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventDispatcher: obtain _listeners before if #30328

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

erasta
Copy link
Contributor

@erasta erasta commented Jan 15, 2025

Description

On EventDispatcher I noticed _listeners member is first checked if it exists, and only then a local copy is obtained.
Very minor optimization - first obtain the member and only then check if it is not undefined.

Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 339.53
79.09
339.53
79.09
+0 B
+0 B
WebGPU 491.01
136.43
491.01
136.43
+0 B
+0 B
WebGPU Nodes 490.47
136.32
490.47
136.32
+0 B
+0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 465.42
112.15
465.39
112.16
-31 B
+10 B
WebGPU 561.58
152.14
561.55
152.15
-31 B
+12 B
WebGPU Nodes 516.97
141.71
516.93
141.72
-31 B
+12 B

@Mugen87 Mugen87 merged commit 782b621 into mrdoob:dev Jan 15, 2025
12 checks passed
@Mugen87 Mugen87 added this to the r173 milestone Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants