Suspecting downgraded performance
I suspect the following code, is maybe causing down-graded performance:
std::stringstream body;
body.str(); // <--- here
Is a stringstream indeed slow in converting 'large' data to a string?
Another cause could be in ParseJson:
Json::parse(input);
Additional debugging and performance measurements are required!
I see it takes 6ms to execute a simple swarm/peers request. Sure, this specific call could take longer. Yet other API calls are executed (far) below 1ms. And the difference with curl command doesn't show much time differences between those different API calls.
The main difference is the body response size.
Just a thought experiment. Again, does requires follow-up research.
Uhm, the difference is already almost zero when building a Release build. But still, even with a relative small HTTP body size I see a noticeable difference in execution times.