This code of D creates a dummy 47,6 MB text file filled with Nul characters in about 9 seconds

import std.stdio, std.process;

void main() {

        writeln("Creating a dummy file");
        File file = File("test.txt", "w");

   for (int i = 0; i < 50000000; i++)
        {
                file.write("\x00");
        }
   file.close();

}


While GNU coreutils dd can create 500mb dummy Nul file in a second.
https://github.com/coreutils/coreutils/blob/master/src/dd.c

What are the explanations for this?

Reply via email to