On Wed, 08 Nov 2017 12:08:15 GMT, Dietmar Maurer wrote:

To accelerate the process, it would of course also be possible to work
on this step by step, keeping the thread based approach for Windows and
using non-blocking I/O for Posix systems.

Also, I do not really understand how FileStream implementation works.
Seems current drivers use module vibe.core.drivers.threadedfile,
but that file contains the following comment:

Thread based asynchronous file I/O fallback implementation

But the module does not use any threads, and use blocking IO calls.
So all vibe.d file-io is in fact blocking? What do I miss?

The old Posix implementation indeed just used blocking calls (except for the win32 driver). However, it will be deprecated very soon, and the replacement, vibe-core, already uses actual thread-backed I/O for non-Windows systems through the "eventcore" library: https://github.com/vibe-d/eventcore/blob/master/source/eventcore/drivers/threadedfile.d

Even if the old implementation is currently still the default, I'd recommend starting any new developments with the new module, not just for this reason, but also because to uses much more principled, robust, and idiomatic approaches in many areas. The switch can be made by inserting this into the project's dub.sdl:

dependency "vibe-d:core" version="~>0.8.1"
subConfiguration "vibe-d:core" "vibe-core"

or for dub.json:

{
    ...
    "dependencies": {
        ...
        "vibe-d:core": "~>0.8.1"
    },
    "subConfigurations": {
        "vibe-d:core": "vibe-core"
    }
}

The only gotcha is that even if in theory vibe-core is considerably faster than the old implementation, due to the excessive use of class based polymorphism in the HTTP module, the HTTP server will actually perform worse than before. This problem will be addressed in the near future.