vibe-d / vibe.d

Official vibe.d development
MIT License
1.15k stars 284 forks source link

Urged the use of libuv #1464

Open shumtn opened 8 years ago

shumtn commented 8 years ago

For higher line capacity and stability, strong demand to replace libevent into libuv, Microsoft in a number of projects are in use libuv, which may account for libuv powerful.

bitraft commented 8 years ago

+1 I has create a project to automatic convert uv header file to d, not finished yet.

s-ludwig commented 8 years ago

libuv AFAIK isn't designed to integrate with UI event loops, which is an important goal for vibe.d. Also, with all event libraries so far there have been some slightly misfitting abstractions that result in a slight performance hit (which can still be important once the system performance reaches a certain level). Having C library dependencies is also always somewhat annoying in comparison with pure DUB packages.

For these reasons, the plan is to go with a native D abstraction. Currently there is libasync, as well as the prototype one that I used for tuning performance.

bitraft commented 8 years ago

Libuv provide pipe and IO asynchronous, like file open, read, deleted. For windows it support IOCP for performance.

libasync is good but not yet ready for product quality, lack cross-platform capability.

Maybe Libuv is slow but on my old code it is fast then libevent. Compare to libevent libuv provide more features.

I don't why we need integrate UI event loops into a web framework, I guess with UI event loops the performance will drop compare to pure IO event loops.

I guess @s-ludwig is busy with a lot things, so if some body else has the capability to do this will be great.

s-ludwig commented 8 years ago

I don't why we need integrate UI event loops into a web framework, I guess with UI event loops the performance will drop compare to pure IO event loops.

vibe.d is not a pure web framework. I have multiple GUI applications using it and they greatly profit from its fiber based asynchronous model. The event loop that supports UI messages is in fact not slower (both map to the same code internally), so no need to worry there.

But if you or someone else interested in this have the time to implement a libuv based EventDriver, I'd accept a pull request and I'll make sure that the pure D solution for the upcoming vibe-core replacement implementation will be up to par regarding performance.

shumtn commented 8 years ago

s-ludwig your direction is right, I was raised with libuv is because vibe uses libevent, if libevent vs libuv, I prefer to use libuv, but if in the future entirely libasync, I am definitely a very good choice because it is achieved with a D, not with the other DLL, so to achieve complete with D

bitraft commented 8 years ago

The demios.libuv is ready for use: https://github.com/changloong/libuv

I has test all struct fields size and offset, they fit in mac64 and linux32. win32 is not test yet.