wine disk slow than linux

Questions about Wine on Linux
Locked
game12138
Level 2
Level 2
Posts: 21
Joined: Wed Oct 10, 2018 10:35 pm

wine disk slow than linux

Post by game12138 »

I use c progrom to test disk speed, but progrom in wine slow than the progrom build by native linux
and this my code, image is test record

Code: Select all


#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define BLOCK_SIZE 4096 // 4KB

int main() {
    FILE* fp;
    char* buf;
    long long i, j, n;
    double t1, t2, speed;

    char const* _FileName = "test.dat";

    n = (10 * 1024 * 1024 ) / (4);
    buf = (char*)malloc(BLOCK_SIZE);

    printf("Test start\n");
    printf("Create data ...\n");


    srand(time(NULL));
    for (i = 0; i < BLOCK_SIZE; i++) {
        buf[i] = rand() % 256;
    }
    printf("Create data done\n");

    printf("\n");

    printf("Write file ...\n");

    fp = fopen(_FileName, "wb");
    t1 = clock();
    for (i = 0; i < n; i++) {
        fwrite(buf, BLOCK_SIZE, 1, fp);
    }
    t2 = clock();
    fclose(fp);
    printf("Write file done\n");


    double ttt = n * BLOCK_SIZE / (t2 - t1);
    speed = n * BLOCK_SIZE / ((t2 - t1) / CLOCKS_PER_SEC);
    printf("Write speed: %.2f MB/s\n", speed / 1024 / 1024);

    printf("\n");

    printf("Read file ...\n");

    fp = fopen(_FileName, "rb");
    t1 = clock();
    for (i = 0; i < n; i++) {
        fread(buf, BLOCK_SIZE, 1, fp);
    }
    t2 = clock();
    fclose(fp);
    printf("Read file done\n");


    speed = n * BLOCK_SIZE / ((t2 - t1) / CLOCKS_PER_SEC);
    printf("Read speed: %.2f MB/s\n", speed / 1024 / 1024);

    free(buf);
    return 0;
}

Attachments
IOTest_table.jpg
IOTest.jpg
howtoreader
Newbie
Newbie
Posts: 3
Joined: Sat Jan 20, 2024 9:29 pm

Re: wine disk slow than linux

Post by howtoreader »

Which compilers and flags did you use? Which version of Linux and Wine were used? Was the same hard drive used, and what kind of drive is it?

I wonder if the write speeds are so much closer because they are being cached by the host rather than fully written ("sync") to disk at that moment. Thank you for sharing the test program and data anyway.
game12138
Level 2
Level 2
Posts: 21
Joined: Wed Oct 10, 2018 10:35 pm

Re: wine disk slow than linux

Post by game12138 »

howtoreader wrote: Sun Jan 21, 2024 1:55 am Which compilers and flags did you use? Which version of Linux and Wine were used? Was the same hard drive used, and what kind of drive is it?

I wonder if the write speeds are so much closer because they are being cached by the host rather than fully written ("sync") to disk at that moment. Thank you for sharing the test program and data anyway.
Ubuntu 22.04, Linux ...6.2..., wine-stable 8.0
progrom compilers by vs2022 msbuild,both linux and windows progrom.

And this is another test
120G, 12352 files, progrom read and write, like copy
wine only 451MB/s, slowest
20240122091132.jpg
Locked