New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get tag information only when it's necessary #9038
Conversation
I have tested this item ✅ successfully on bde9169 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9038. |
@shur getItemTags() is used in many places in J. Could you have a look? |
getItemTags() is used without any conditions in generic articles model: getItems function from this model is often used to get a list of articles in many places such as:
In my PR I suggest a test with one module on a page (mod_articles_category), but you can use any of these content modules to do the same tests. Probably, using several different modules on a page will help to see the problem better because none of these content modules display tags, but create lots of unnecessary queries to get tag information (1 per one article). |
I think we can improve this PR further so that it will also improve performance if users choose to show tags in the menu parameter. I come up with this changes staging...joomdonation:patch-4
With this change, it helps reduce the number of queries and also memory (note the tags property of $item object now is just a stdClass object instead of JHelperTags object) Could we discuss about this additional change ? |
Although i think this PR improves a lot for those not using tags, i also agree with @joomdonation i think this can be improved even for those using tags. IMHO, for performance, anything that can be fetched outside the for cycles and in one query, should be done that way.
I don't now exactly where the tags property is used, but will this part be B/C? |
It is used to just get tags list like this https://github.com/joomla/joomla-cms/blob/staging/components/com_content/views/category/tmpl/blog_item.php#L29-L31 If we worry about B/C, we can still create JHelperTags object for each item, just don't call getItemTags method to get the tags data. |
right |
very well make another #pr i will be happy to test.... but "stay on topic" and test this simple one .... is a huge perfomance boost for those don't use tags this could be easly committed, |
I have tested this item ✅ successfully on bde9169 @alikon you are right we should stay on the topic. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9038. |
OK. I will make a new PR after this one is merged. Since we have two successful tests, could we get this PR merged ? It is nice to have it in Joomla 3.5.0 |
@alikon @joomdonation |
@shur The reason I propose to make a new method because I don't like the old code, want to leave it as how it is for B/C purpose. I could not understand why the tags property of $item object (article in this case) need to be an object of JHelperTags class... Actually, while discussing with @andrepereiradasilva about it, we thought that the getItemsTags can just be a static method..... So after this PR is merged (it is simple and I hope it will be in 3.5.0), I will create a new PR and we can discuss about it further. |
RTC. Thanks. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9038. |
Get tag information only when it's necessary
I discovered that Joomla generates lots of queries requesting article tags. Often tag queries are unnecessary when tags are not used at all on a certain page, but these queries are still retrieved.
Full description and how to test see here: #9036