You could remove the matrixArray. List operations are in my experience infamously slow. You could look at numarray. But in this case it migh make sense to simply use the code that you use to generate matrixArray to directly draw on to the window.