Page MenuHomeFeedback Tracker

Writing to file in a real thread
Waiting for feedback from reporter, UrgentPublic

Description

We all know IO operations in DayZ can be pretty intense and also cause lagspikes, especially when writing / reading a lot of data.

I have two things I would like to see implemented, where the first one should be pretty simple and the second one maybe not that simple:
1st:
Writing a file in a real extra thread. Basically what I mean is something like this:

void SaveMyJson(MyBigClass config) {
    string json = "";
    JsonSerializer serial = new JsonSerializer();
    serial.WriteToString(config, true, json);
    FileHandle handle = OpenFile("$profile:myConfig.json", FileMode.WRITE);
    if (handle == 0)
        return;
    // Now comes the new Part. Instead of using FPrintF(handle, json); and CloseFile(handle); we use
    FPrintFAsync(handle, json); // this will spawn a new thread, or just uses a sleeping worker thread and writes the file to the disk and then closes the handle for us. It also has to ensure the data is not read while writing or caching the data like it's already written to the disk. Or Maybe have a callback when the file is fully written and then we can handle it ourselfs in script
}

2nd:
Reading from Disk Async
This is basically reading a whole file into a string with a Callback function called when the IO operation is finished, so we don't have to wait until a bigger file is fully read, but can continue with the rest and when the file is read, we are notified via the callback and then handle loading the file

Details

Severity
Feature
Resolution
Open
Reproducibility
Always
Operating System
Windows 11 x64
Category
General

Event Timeline

Geez changed the task status from New to Feedback.May 21 2024, 11:16 AM