laravel - Optimize image loading iteration in php -
i have laravel application in user presented list of episodes, each screenshot. each screenshot loaded inside foreach loop in view per pseudo code:
foreach $episodes $episode $episode->getscreenshot($episodeid); endforeach
the getscreenshot()
method resolves specific screenshotlocator
class out of ioc
container so:
$screenshotlocator = app::make('\animekyun\images\screenshots\screenshotlocator');
(i'm reading things binding container singleton. consider? it's not bound @ all)
the screenshotlocator
class designed build path actual screenshots folder (source below) using episode
model. screenshots (there multiple per episode) stored in folder structure , necessary files loaded , stored in collection
.
the loading of screenshots takes 40 ms
out of 135 ms
entire page load on digital ocean droplet. (10x run benchmark)
so question ways optimize this?
source screenshotlocator
class: http://laravel.io/bin/6l19r
Comments
Post a Comment