How quickly can you break a long string into lines?
lemire.me
lemire.me
without going into much deep analysis, id try writing the newlines in a different loop: you are hitting the cache(and memory) in a different way when memcopying and when writing directly.