From 4b0ea34fe099cc7b3a77225f312dda401ba75768 Mon Sep 17 00:00:00 2001 From: Howland Owl Date: Mon, 7 Oct 2013 20:10:43 +0300 Subject: [PATCH] note on speed increase --- textmode.coffee | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/textmode.coffee b/textmode.coffee index 9b95793..99ab060 100644 --- a/textmode.coffee +++ b/textmode.coffee @@ -980,6 +980,7 @@ class @ImageTextMode @font = new ImageTextModeFont( { chars: chars, height: height } ) # 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 ) -> w = @getWidth() * @font.width @@ -1013,12 +1014,6 @@ class @ImageTextMode chr = @font.chars[ pixel.ch.charCodeAt( 0 ) & 0xff ] i = 0 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 ) i += 1