Closed tremby closed 9 years ago
I am very curious where this unnecessary 200ms is coming from. I'll try to run blackfire on it later this day to pinpoint the issue.
Indeed, we're using curl now but it was Guzzle before #69 .
It could be because of the number of simultaneous requests that curl allows?
In my case I believe no actual requests are being made; they are all freshly cached.
I'll double check that when in the office.
I was right that no requests were being made. But I found the issue. It's to do with my development environment, which is a Vagrant VM loading its files via NFS from the host machine. It turns out that this is just slow, and the delays are when PHP is including other source files. If I run the routine to get a fresh API object again (once the classes are already loaded), it runs over all the logic again in ~1ms.
So, false alarm, and apologies.
However, while researching this and in my wondering if I could get around it, I noticed that there appears to be an incomplete comment at https://github.com/prismicio/php-kit/blob/master/src/Prismic/Api.php#L349, "The default configuration of the HTTP adapter used in the kit; this is entirely overridable by passing" -- passing what, to what, when? :)
[edit: I originally pasted completely the wrong link above]
I'll leave this open in case you want to look at that documentation bug -- otherwise close at will.
The doc is fixed, thank you!
Even when the API data is cached,
Api::get
is slow. It's taking around 200ms for me at the moment. This seems like madness given that no actual requests are being made.I narrowed it down and a significant chunk of this time is spent on the
defaultHttpAdapter()
function.I believe it is slower since #69 was merged. I wonder if this could be mitigated if using a particular HTTP adapter rather than the default one? Perhaps you can weigh in, @RobinvdVleuten?