This function is called a lot when printing a lot of text, and is very slow -- this speeds it up a bit.