cpp-ipfs-http-client icon indicating copy to clipboard operation
cpp-ipfs-http-client copied to clipboard

Suspecting downgraded performance

Open melroy89 opened this issue 3 years ago • 1 comments

I suspect the following code, is maybe causing down-graded performance:

In FetchAndParseJson():

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.

melroy89 avatar Jan 11 '22 02:01 melroy89

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.

melroy89 avatar Jan 11 '22 02:01 melroy89