I parsed 10 tiff images at Chrome to measure the performance. I look the
time spent in "parseTiff" function using chrome's profiler.
Results;
original algorithm: 7685 ms
new algorithm: 1819 ms
Differences in code;
Original algorithm was using CanvasRenderingContext2D.fillRect function
to paint the canvas. New alorithm gets the pixel byte data using
CanvasRenderingContext2D.getImageData function and put the rgba values
directly into pixel array. Finally pixel array is put back to canvas
using CanvasRenderingContext2D.putImageData function.
I parsed 10 tiff images at Chrome to measure the performance. I look the time spent in "parseTiff" function using chrome's profiler.
Results; original algorithm: 7685 ms new algorithm: 1819 ms
Differences in code; Original algorithm was using CanvasRenderingContext2D.fillRect function to paint the canvas. New alorithm gets the pixel byte data using CanvasRenderingContext2D.getImageData function and put the rgba values directly into pixel array. Finally pixel array is put back to canvas using CanvasRenderingContext2D.putImageData function.