There are several things that can cause lag. There's a topic about this somewhere. You should post there instead of making a new thread.
Also, specifically it could lag, because you are re-drawing the windows all the time and/or having many windows created, but turned the just inactive/invisible. Every extra window needs some CPU and every window redraw needs time to be completed. So if you constantly re-draw (also called refresh), lag will increase immensely.