> Is there any way to do this faster? Create the full table in a string, including the <table> tags, and insert it into the document at one time. Each time you insert an element into the document, the browser does some calculations and checks. By doing it in one insert you save it work.
Whenever you're dealing with HTML in strings, be careful about escaping characters like > that may be in the actual content and need to be rendered literally. At minimum you'll want to convert < to < and > to > for safety.