On 9/21/17 11:49, bitwise wrote:
On Thursday, 21 September 2017 at 08:01:23 UTC, Vadim Lopatin wrote:
There is a simple set of simple web server apps written in several
languages (Go, Rust, Scala, Node-js):

https://github.com/nuald/simple-web-benchmark

I've sent PR to include D benchmark (vibe.d).

I was hoping it could show performance at least not worse than other
languages.
But it appears to be slower than Go and even Node.js

Are there any tips to achieve better performance in this test?

Under windows, I can get vibe.d configured to use libevent to show
results comparable with Go. With other configurations, it works two
times slower.

Under linux, vibe.d shows 45K requests/seconds, and Go - 50K. The only
advantage of D here is CPU load - 90% vs 120% in Go.

I'm using DMD. Probably, ldc could speed up it a bit.

Probably, it's caused by single threaded async implementation while
other languages are using parallel handling of requests?

Doesn't vibe-d use Fibers?

I tried to build a simple web server with a fiber-based approach once -
it was horribly slow.

I hope C# (and soon C++) style stackless resumable functions will
eventually come to D.



The purpose of Async/Await in C# is not to improve performance but to free up the thread while some long-running IO operation is taking place (such as talking to a remote server). In C# the biggest use case is ASP.NET/Core which allows the server to process many times the number of incoming requests(threads) than there are physical cores on the device. This works because another request is often doing some other work behind the scenes (DB query, HTTP call to remote service, etc.)

In fact MSFT says that Async/Await will decrease performance of a single instance of execution and are not to be used in situations where the delay is less than about 50ms (in 2011, i've heard that it could be even less with newer versions of the compiler) as it can actually take more time dehydrate/rehydrate the thread than the blocking operation would've taken.

--
Adam Wilson
IRC: LightBender
import quiet.dlang.dev;

Reply via email to