Project

General

Profile

Actions

Bug #22193

closed

Inefficient fetch of templates from table sys_template

Added by Alexander Weggerle over 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2010-02-25
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.3
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Every basic template which is included in another template is fetched with a single database query.
So on sites which includes many additional templates in the root template this could be a performance bottleneck.

I attached a patch which fetches all the needed templates with one query.

For the testet site the patch gives an performance boost from 40 requests/s before to 62 requests/s after.
The site includes about 30 basic templates into the root template, which is rather unusual. So i don't think the performance enhancement will be so big on typical sites.
(issue imported from #M13669)


Files

sys_templates.diff (1.61 KB) sys_templates.diff Administrator Admin, 2010-02-25 21:59
sys_templates_2.diff (1.65 KB) sys_templates_2.diff Administrator Admin, 2010-02-25 22:47
sys_templates_3.diff (1.75 KB) sys_templates_3.diff Administrator Admin, 2010-02-25 23:39
13669_4.diff (1.77 KB) 13669_4.diff Administrator Admin, 2010-02-26 10:07
13669_v2.patch (2.02 KB) 13669_v2.patch Administrator Admin, 2010-02-26 12:59
Actions #1

Updated by Georg Ringer over 14 years ago

nice catch!
at least from reading there is at least one problem: the previous way takes care about the order of the templates. your patch doesn't!
IMO you need to first create an array as the $basedOnArr and then collect the sys_templates in a 2nd array and then you can run through the $basedOnArr and fetch the according templates from the 2nd array. I hope this is understandable.

Actions #2

Updated by Alexander Weggerle over 14 years ago

Ah, you're right. I missed that issue!
I attached a new patch sys_templates_2.diff which considers the sorting.
I think it's better to let the SQL-Server sort, and not the application... Correct me, if you think your way is better.

Actions #3

Updated by Georg Ringer over 14 years ago

ah, didn't knew that way but I don't know if this works with DBAL.
maybe put it into the dev-list for discussion?

Actions #4

Updated by Alexander Weggerle over 14 years ago

You catched me again. I'm pretty new in the core development and missed also that issue. Postgresql didn't support that SQL feature and it isn't used in the whole typo3-src.
Under this circumstances i decieded to follow your first recommendation. This has also the advantage that the database connection is immediately closed after the rows are fetched.
See: sys_templates_3.diff

Actions #5

Updated by Georg Ringer over 14 years ago

loooks good now if you change those things to follow the CGL:
- initilize $subrows as array();
- comments should be above and one tab indented
- the continue should be inside { }
- before a { only a space and no tab
- combining strings with . needs always a space before and after the .

feel free to send _4 to the core list (after checking the rules there) and I hope you are not discouraged by my comments

Actions #6

Updated by Alexander Weggerle over 14 years ago

Thanks for your patience and your help. You don't discouraged me at all.
I attached the 13669_4.diff, which follows the CGL.

Actions #7

Updated by Benni Mack over 14 years ago

committed version2 to trunk (rev. 7086).

Actions #8

Updated by Susanne Moog over 13 years ago

  • Target version deleted (4.4.0)
Actions

Also available in: Atom PDF