Simple web server benchmark - vibe.d is slower than node.js and Go?

bitwise bitwise.pvt at gmail.com
Sat Sep 23 22:07:58 UTC 2017


On Friday, 22 September 2017 at 09:48:47 UTC, Sönke Ludwig wrote:
> Am 21.09.2017 um 20:49 schrieb bitwise:
>> 
>> 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.
>
> It uses them and the overhead actually diminishes once the 
> application does anything meaningful. To test this, I created 
> two low-level tests for eventcore that mimic a minimal HTTP 
> server. AFAIR, I got around 300kreq/s on a single core without 
> fibers and around 290kreq/s with fibers, which amounts to an 
> overhead of about 0.1µs per request.

Interesting - I thought the cost would be higher.

Of the few different architectures I tried, the fiber based 
approach was much slower. It's possible that my implementation 
did too many unnecessary context switches.

> Stackless fibers would be really nice to have because of the 
> merged stacks and the lower amount of reserved memory required 
> (even though this is not a really big issue on 64-bit systems), 
> but for pure performance I don't think they would be a critical 
> addition.

I suppose this is off topic, but for games, or any realtime 
application where things need to run intermittently, but at high 
frequency, and in high numbers, stackless resumable functions are 
a big win. A lot of AI I've been writing lately (including some 
flocking behaviors) have been built on top of C# IEnumerators.





More information about the Digitalmars-d mailing list