You could do it so that you create only 1 row (500 tiles) of tiles in one frame.
Then the program won't need to create them all in one frame and
it won't lag. You could even make a progress bar to indicate the progress.
Sorta like what I did with the level loading of the unfinished Worm War game.