Author Topic: Loading categorie list tree takes a lot of time  (Read 1608 times)

sandomatyas

  • Jr. Member
  • **
  • Posts: 304
Loading categorie list tree takes a lot of time
« on: July 06, 2020, 17:28:08 pm »
There is a site with ~15.000 categories. As far as I can see VM uses huge amout of database queries when loads the tree recursively and it takes time, ~20-30 secs when it's not in the cache. Could you please consider optimizing this part of the code?

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 817
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Loading categorie list tree takes a lot of time
« Reply #1 on: July 06, 2020, 19:47:35 pm »
very bad idea,

maybe you don't know about psychology of custmer's on eshop, if you want show tree of 15000 categories.

Eshop is not created for developer, but for customer's and must be higly bussines.
If not, is only for fun :)
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

sandomatyas

  • Jr. Member
  • **
  • Posts: 304
Re: Loading categorie list tree takes a lot of time
« Reply #2 on: July 07, 2020, 11:22:35 am »
I know it is not optimal, I was not who built the site, but it is there, it was working before VM 3.8

BTW I had a quite similar issue with a non-Joomla site, there was a kind of parent-child tree solution assigned to the items which is quite similar how VM handles categories. When I worked with this, it took more than a minute to build the parent-child tree with a recursive function and a query in every loop. If I'm right this is how VM handles this. I refactored the code, fetched the tree elements with a single sql query and built the tree with a recursive function but without internal queries, there was only array/object handling with php scripts. I got the same result as above but in less than 2 seconds.
So maybe it does worth some effort do build more scalable code :)

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 817
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Loading categorie list tree takes a lot of time
« Reply #3 on: July 07, 2020, 11:39:40 am »
This question is for VM DEV :)

www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

sandomatyas

  • Jr. Member
  • **
  • Posts: 304
Re: Loading categorie list tree takes a lot of time
« Reply #4 on: July 07, 2020, 16:11:00 pm »
Should I open a new topic or is it possible to move it there?