Because the preallocation version runs so slow, change to append mode to
have a try.