Performance slowdown V4

Phoca Gallery - image gallery extension
paulv888
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 29 Mar 2023, 02:25

Performance slowdown V4

Post by paulv888 »

Hi,

Thank you for this great component, I have been a happy user for many years!

I recently upgraded to V4 and found that my categories with lots of images loads a lot slower. I looked into this and the main issue seems to me the Joomla\CMS\Router\Route::_('...') calls we do to get the Route for the different links (Download/Geo/Exif/..). Which leads to PhocaGalleryCategory::getCategoryById($id), which has 2 db calls in it to retrieve the category information.

For a simple test Category View. with 1 image to display, with download/geo/exif links. This is called 20 times...

Code: Select all

/components/com_phocagallery/views/category/view.html.php(652): Joomla\CMS\Router\Route::_('...')
/components/com_phocagallery/views/category/view.html.php(652): Joomla\CMS\Router\Route::_('...')
/administrator/components/com_phocagallery/libraries/phocagallery/image/imagefront.php(1086): Joomla\CMS\Router\Route::_('...')
/administrator/components/com_phocagallery/libraries/phocagallery/image/imagefront.php(1086): Joomla\CMS\Router\Route::_('...')
/administrator/components/com_phocagallery/libraries/phocagallery/image/imagefront.php(1086): Joomla\CMS\Router\Route::_('...')
/administrator/components/com_phocagallery/libraries/phocagallery/image/imagefront.php(1086): Joomla\CMS\Router\Route::_('...')
/administrator/components/com_phocagallery/libraries/phocagallery/image/imagefront.php(1086): Joomla\CMS\Router\Route::_('...')
/administrator/components/com_phocagallery/libraries/phocagallery/image/imagefront.php(1086): Joomla\CMS\Router\Route::_('...')
/components/com_phocagallery/views/category/tmpl/default_images.php(226): Joomla\CMS\Router\Route::_('...')
/components/com_phocagallery/views/category/tmpl/default_images.php(226): Joomla\CMS\Router\Route::_('...')
/components/com_phocagallery/views/category/tmpl/default_images.php(226): Joomla\CMS\Router\Route::_('...')
/components/com_phocagallery/views/category/tmpl/default_images.php(226): Joomla\CMS\Router\Route::_('...')
/components/com_phocagallery/views/category/tmpl/default_images.php(226): Joomla\CMS\Router\Route::_('...')
/components/com_phocagallery/views/category/tmpl/default_images.php(226): Joomla\CMS\Router\Route::_('...')
/components/com_phocagallery/views/category/tmpl/default_images.php(260): Joomla\CMS\Router\Route::_('...')
/components/com_phocagallery/views/category/tmpl/default_images.php(260): Joomla\CMS\Router\Route::_('...')
/components/com_phocagallery/views/category/tmpl/default_images.php(260): Joomla\CMS\Router\Route::_('...')
/components/com_phocagallery/views/category/tmpl/default_images.php(260): Joomla\CMS\Router\Route::_('...')
/components/com_phocagallery/views/category/tmpl/default_images.php(260): Joomla\CMS\Router\Route::_('...')
/components/com_phocagallery/views/category/tmpl/default_images.php(260): Joomla\CMS\Router\Route::_('...')
Not sure if actually need to do this route call for links that are not directly visible, or that we can maybe do without the db calls in getCategoryById($id)?

Thanks,
paulv888
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 29 Mar 2023, 02:25

Re: Performance slowdown V4

Post by paulv888 »

Further I noticed that PhocaGalleryCategory::getCategoryById('...') is called another 4 times per image from here: Not s

Code: Select all

#0 /components/com_phocagallery/router.php(85): PhocaGalleryCategory::getCategoryById('')
#1 /libraries/src/Component/Router/RouterView.php(116): PhocagalleryRouter->getCategorySegment('', Array)
#2 /administrator/components/com_phocagallery/libraries/phocagallery/path/routerrules.php(94): Joomla\CMS\Component\Router\RouterView->getPath(Array)
#3 /libraries/src/Component/Router/RouterView.php(229): PhocaGalleryRouterrules->build(Array, Array)
#4 /components/com_phocagallery/router.php(316): Joomla\CMS\Component\Router\RouterView->build(Array)
#5 /libraries/src/Router/SiteRouter.php(441): PhocagalleryRouter->build(Array)
#6 /libraries/src/Router/Router.php(405): Joomla\CMS\Router\SiteRouter->buildSefRoute(Object(Joomla\CMS\Router\SiteRouter), Object(Joomla\CMS\Uri\Uri))
#7 /libraries/src/Router/Router.php(192): Joomla\CMS\Router\Router->processBuildRules(Object(Joomla\CMS\Uri\Uri))
#8 /libraries/src/Router/Route.php(141): Joomla\CMS\Router\Router->build('...')
#9 /libraries/src/Router/Route.php(93): Joomla\CMS\Router\Route::link('...', '...', true, 0, false)
#10 /modules/mod_menu/src/Helper/MenuHelper.php(154): Joomla\CMS\Router\Route::_('...', true, 0)
#11 /modules/mod_menu/mod_menu.php(16): Joomla\Module\Menu\Site\Helper\MenuHelper::getList(Object(Joomla\Registry\Registry))
#12 /libraries/src/Dispatcher/ModuleDispatcher.php(52): include('...')
#13 /libraries/src/Dispatcher/ModuleDispatcher.php(55): Joomla\CMS\Dispatcher\ModuleDispatcher::Joomla\CMS\Dispatcher\{closure}('...', NULL)
#14 /libraries/src/Helper/ModuleHelper.php(281): Joomla\CMS\Dispatcher\ModuleDispatcher->dispatch()
#15 /libraries/src/Helper/ModuleHelper.php(161): Joomla\CMS\Helper\ModuleHelper::renderRawModule(Object(stdClass), Object(Joomla\Registry\Registry), Array)
#16 /libraries/src/Document/Renderer/Html/ModuleRenderer.php(99): Joomla\CMS\Helper\ModuleHelper::renderModule(Object(stdClass), Array)
#17 /libraries/src/Document/Renderer/Html/ModulesRenderer.php(50): Joomla\CMS\Document\Renderer\Html\ModuleRenderer->render(Object(stdClass), Array, NULL)
#18 /libraries/src/Document/HtmlDocument.php(565): Joomla\CMS\Document\Renderer\Html\ModulesRenderer->render('...', Array, NULL)
#19 /libraries/src/Document/HtmlDocument.php(848): Joomla\CMS\Document\HtmlDocument->getBuffer('...', '...', Array)
#20 /libraries/src/Document/HtmlDocument.php(633): Joomla\CMS\Document\HtmlDocument->_renderTemplate()
#21 /libraries/src/Application/CMSApplication.php(1017): Joomla\CMS\Document\HtmlDocument->render(false, Array)
#22 /libraries/src/Application/SiteApplication.php(714): Joomla\CMS\Application\CMSApplication->render()
#23 /libraries/src/Application/CMSApplication.php(299): Joomla\CMS\Application\SiteApplication->render()
#24 /includes/app.php(61): Joomla\CMS\Application\CMSApplication->execute()
Not sure if I could prevent that somehow.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Performance slowdown V4

Post by Jan »

Hi, thank you for the info, unfortunately I am not the developer of new router so really hard to say. The only idea which I have is to somehow do singleton for the asking of the ID so the SQL command is not run many times for one ID. I will take a look at it for some next version and for now unfortunately I have really no idea if I will be able to change the new router behaviour :-(

Jan
If you find Phoca extensions useful, please support the project
Post Reply