[Issue 7033] New: File.rawWrite is slow on Windows

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 29 19:01:08 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=7033

           Summary: File.rawWrite is slow on Windows
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: performance
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-11-29 19:00:04 PST ---
This D2 program runs in about 5.13 seconds on my PC, on Windows:


import std.stdio;
void main() {
    auto f = File("bytes_test.dat", "wb");
    ubyte[3] RGB;
    foreach (_; 0 .. 1_000_000)
        f.rawWrite(RGB);
}



While this C program runs in about 0.14 seconds:


#include <stdio.h>
int main() {
    FILE *f = fopen("bytes_test.dat", "wb");
    unsigned char RGB[3] = {0};
    int i;
    for (i = 0; i < 1000000; i++)
        fwrite(RGB, 1, 3, f);
    return 0;
}


See also:

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=30858

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=30866

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list