Open yamadapc opened 8 years ago
I think the performance difference between the two could lie in the templating engine and string handling. Most of my tests with pure network handling seem to perform higher with Go, but I lack the experience of tuning D for these use-cases.
Yeah... It's a very close call, not indicative of any real performance metric. I wouldn't doubt Go has a more optimised networking stack than Vibe.D. It's just fun seeing one get so close to the other.
Usually compiling with LDC
or GDC
instead of DMD
gives a significant performance boost to D programs. As far as more strict benchmarking goes, I think techempower does the job.
Vibe.D templates are converted to native code at compile time, as far as I know, so I wouldn't doubt that indeed D had an edge on template rendering.
The size of responses is also slightly different, though I think Go is actually sending less data than Vibe.D here. The commit message has the full wrk
output for those types of comparisons.
Adds vibe.d D implementation. To get the best performance results, it should be compiled using
ldc2
orgdc
on Linux.On my Macbook Pro i7 machine, running inside a VM, the GDC compiled version has roughly 2x throughput and almost 10x lower latency than the Golang version, when running with a single CPU.
When the number of CPUs increases (I tested with 4), the results change. The Golang version seems to be better at taking advantage of all the cores. However, when scaling
wrk
to use more threads and more connections, the D version starts getting faster; on my tests, up to 33% faster with 1/3x lower latency.In all tests, the maximum latency (probably caused by a GC pause) is much lower in D, staying bellow
30ms
even with 100 connections and 8 threads fromwrk
.The results on Ubuntu were:
See the commit message for more.
Also adds a vagrantfile to compile the Go and Vibe.d versions on a VirtualBox environment with 2048MB of RAM and 4 CPUs. It also includes
wrk
on the VM for benchmarking.To compile D, it installs GDC, which is the GCC frontend for D, and LDC, which is the LLVM frontend for D.