• This optimization is perfect for drawing horizontal lines

    Display 240x240(320)

    before: 990ms, after 266ms

    hLines = () =>{
          g.clear().setColor(0xfffff);
          xm = 240;
          ym = 240;
          t1 = Date.now();
          for ( var y = 0; y <= ym; y+=10){
              g.drawLine(0,y,xm,y);
          }
          t2 = Date.now()-t1;
          g.setColor(0xff0).setFont("6x8",2).drawS­tring(t2.toFixed()+"ms",0,0,true);
    };
    

    I guess it should be possible to optimize this for vertical line too?

About

Avatar for MaBe @MaBe started