std.net.curl : Performance

rinfz cherez at mailbox.org
Mon Nov 9 20:40:59 UTC 2020


On Monday, 9 November 2020 at 19:55:07 UTC, Vino wrote:
> ...

The only curl option you need to set within the loop is the 
CurlOption.url. So your foreach block should look more like:

foreach (...) {
     string url = chain(apihost, only(':'), to!string(apiport), 
apiuri).to!string;
     https.handle.set(CurlOption.url, url);
     https.perform();
     scope(failure) exit(-4);
     scope(exit) https.shutdown;
     apidata.insert(tuple(seq, cast(string) content));
     content = [];
}

Every other line can be placed before the foreach.



More information about the Digitalmars-d-learn mailing list