note on speed increase
This commit is contained in:
parent
956748c90b
commit
4b0ea34fe0
1 changed files with 1 additions and 6 deletions
|
|
@ -980,6 +980,7 @@ class @ImageTextMode
|
||||||
@font = new ImageTextModeFont( { chars: chars, height: height } )
|
@font = new ImageTextModeFont( { chars: chars, height: height } )
|
||||||
|
|
||||||
# the majority of time is spent in this routine
|
# the majority of time is spent in this routine
|
||||||
|
# list comprehension seems to speed up from 1.8 seconds to 1.29 seconds from first comprehension / cleanup?
|
||||||
|
|
||||||
renderCanvas: ( canvasElem ) ->
|
renderCanvas: ( canvasElem ) ->
|
||||||
w = @getWidth() * @font.width
|
w = @getWidth() * @font.width
|
||||||
|
|
@ -1013,12 +1014,6 @@ class @ImageTextMode
|
||||||
chr = @font.chars[ pixel.ch.charCodeAt( 0 ) & 0xff ]
|
chr = @font.chars[ pixel.ch.charCodeAt( 0 ) & 0xff ]
|
||||||
i = 0
|
i = 0
|
||||||
for line in chr
|
for line in chr
|
||||||
# [ 0 ... @font.height ]
|
|
||||||
# line = chr[ i ]
|
|
||||||
# for j in [ 0 ... @font.width ]
|
|
||||||
# if line & ( 1 << @font.width - 1 - j )
|
|
||||||
# ctx.fillRect px + j, py + i, 1, 1
|
|
||||||
|
|
||||||
ctx.fillRect px + j, py + i, 1, 1 for j in [ 0 ... @font.width ] when line & (1 << @font.width - 1 - j )
|
ctx.fillRect px + j, py + i, 1, 1 for j in [ 0 ... @font.width ] when line & (1 << @font.width - 1 - j )
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue