Phobos v2 asynchronous IO

Adam Ruppe destructionator at gmail.com
Sat Apr 16 20:41:38 UTC 2022


On Saturday, 16 April 2022 at 19:33:16 UTC, a11e99z wrote:
> On Saturday, 16 April 2022 at 17:29:41 UTC, Adam D Ruppe wrote:
>> On Saturday, 16 April 2022 at 17:17:57 UTC, Tobias Pankrath 
>> wrote:
>>> You have a pointer to the Windows API you mention? Do you 
>>> mean overlapped io?
>>
>> Yes. WriteFileEx and associated things.
>
> https://docs.microsoft.com/en-us/troubleshoot/windows/win32/asynchronous-disk-io-synchronous#asynchronous-io-still-appears-to-be-synchronous

If your point is that the Windows API is both easy to use and 
performs well for the majority of cases, I agree. When data is 
issued from a cache, it is faster to just issue the answer and 
saves you from an allocation down the line since you can keep the 
buffer in the pool.

Of course, there are some cases where you need to do extra 
tuning, but the api makes it possible.

Maybe in theory we could invent something better, but for one, it 
is going to need to be built on what the operating system 
provides anyway, and really, when it comes to api design, you're 
often in good shape copying something that is widely used in the 
real world - even if it is less than perfect, at least its quirks 
are well documented.


More information about the Digitalmars-d mailing list