extiverse / bazaar

The extension marketplace for your Flarum forum.
https://discuss.flarum.org/d/5151
MIT License
59 stars 14 forks source link

Some json/cache benchmarking #72

Closed clarkwinkelmann closed 7 years ago

clarkwinkelmann commented 7 years ago

While working on improvements for the package list endpoint, I noticed a few things.

First, even with a local flagrow.io instance, it takes about 1.7 seconds to load the list of packages when not cached. But once cached, performance can greatly increase:

Before my improvements, I noticed we were caching the raw text response from flagrow.io, but were parsing it and extracting the data key each time. By moving the code around I checked the following. (Time is the average in seconds for 5000 readings from the cache, I did the serie a few times for each case). The cache was already filled at the start of the test.

Caching the raw text clearly has no advantage. The serialized version of the output of json_decode is parsed quicker than JSON itself.

I'm closing this issue immediately, I just wanted a trace of this to stay somewhere. But it's irrelevant in the code because it's closely tied to my own machine.