-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Not sure if you are interested in PRs.
I was wondering how D will do http + json.
On my M1 machine LDC is the most popular option (DMD will require Rosetta, GDC probably possible to build, but there is no pre-generated packages).
LDC is LLVM based D backend. And it is providing more optimized code, but it takes more time for compilation, than reference compiler DMD.
So in D world popular flow is: using DMD in developing iteration, and LDC for preparing deployable to production binary.
So on x86 systems DMD should be even faster!
Using DUB for building I have (with /usr/bin/time):
initial build:
0.40 real 0.37 user 0.05 sys
Second build:
0.05 real 0.03 user 0.00 sys
With go build I have (actually the first build took 2s - probably because it was downloading packages):
Initial build:
0.30 real 0.37 user 0.21 sys
Second build:
0.09 real 0.11 user 0.20 sys
import std.stdio: writeln;
import std.json: parseJSON;
import std.net.curl: get;
void main()
{
auto luke = get("https://swapi.dev/api/people/1").parseJSON();
writeln(luke["name"].str, " has ", luke["eye_color"].str, " eyes");
}