Sped up javascript implementation by batching stringbuilder appends, thus saving lots of little object allocations