Modifying where the line ending is added can be even more optimized when you 
change the parameter to the iterator such that the string is only changed once. 
E.G.: `enumerableRepeat(str & "\n", 3_000_000)`

This would not even be faster if that was done more efficient than introducing 
a string copy.

That using WriteLine() is slower is a pity though. Here we see how simple 
things can change the outcome a lot. I wildly guess it calls "write()" twice, 
which is causing more overhead than the string implementation of Nim which 
copies the string to add the line ending.

Reply via email to