Use StringBuilder instead of StringBuffer when no concurrent access

Replacement of #60