[TYPO3-dev] Code optimization in TYPO3 core
Jérôme Schneider
j.schneider at ameos.com
Tue Jun 29 10:59:05 CEST 2010
Hi TYPO3,
I think I spotted a perf issue in the TYPO3 code, slowing processes down
in backend, when recursively copying page-trees with contents.
The code I take here as a reference is the one of release 4.4.0
t3lib/class.t3lib_tcemain.php:1008: method fillInFieldArray()
line 1056: There's a loop thru *all the fields of all the tables*
line 1111: for most of the fields (switch default) we call
$this->checkValue()
line 1273: checkValue() calls $this->recordInfo() for the field
line 5981: recordInfo() executes a SQL query to get values for the field
As a result: for each page copied, for each table in TCA, for each field
(most of them, the ones that are not system) in this table, there's an
SQL query executed.
Even worst news: recordInfo() executes the SQL query using the given id.
In some cases (and always when copying pages) the id is equals to
something like NEWabcdef (that is, non numerical, and obviously not in
database). Problem is, recordInfo() doesn't care about that, and
executes the SQL query doing an intval() on the given id, resulting in a
SQL query fetching values for uid='0' (which does not make sense).
In a structure where PHP and MySql are on the same server, it might not
hurt much, but when SQL and PHP are on dedicated servers, network
latency makes it incredibly slow (like minutes to copy pagetree
containing 3~4 pages with some content elements)
Someone confirms ? Infirms ? Experienced this already ?
Regards to the community,
Jerome Schneider
AMEOS
More information about the TYPO3-dev
mailing list