Skip to content

Commit 66ecaab

Browse files
s-rigaudSamuel Rigaud
and
Samuel Rigaud
authored
AsciiEffect: avoid useless split operations (#30667)
Co-authored-by: Samuel Rigaud <[email protected]>
1 parent 9817a2c commit 66ecaab

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Diff for: examples/jsm/effects/AsciiEffect.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ class AsciiEffect {
118118
}
119119

120120

121-
const aDefaultCharList = ( ' .,:;i1tfLCG08@' ).split( '' );
122-
const aDefaultColorCharList = ( ' CGO08@' ).split( '' );
123121
const strFont = 'courier new, monospace';
124122

125123
const oCanvasImg = renderer.domElement;
@@ -138,9 +136,19 @@ class AsciiEffect {
138136

139137
}
140138

141-
let aCharList = ( bColor ? aDefaultColorCharList : aDefaultCharList );
139+
let aCharList;
140+
if ( charSet ) {
141+
142+
aCharList = ( charSet ).split( '' );
143+
144+
} else {
145+
146+
const aDefaultCharList = ( ' .,:;i1tfLCG08@' ).split( '' );
147+
const aDefaultColorCharList = ( ' CGO08@' ).split( '' );
148+
aCharList = ( bColor ? aDefaultColorCharList : aDefaultCharList );
149+
150+
}
142151

143-
if ( charSet ) aCharList = charSet;
144152

145153
// Setup dom
146154

0 commit comments

Comments
 (0)