[TYPO3-team-templavoila] Caching of xml2array during rendering

Jigal van Hemert jigal at xs4all.nl
Sun May 31 10:47:58 CEST 2009


Hi Steffen and others,

> It's clear that XMLReader is the one prefered as it's the only way to
> stream the data without loading complete xml to memory.

It really depends on the size of the XML whether it will help to load the
XML partially or entirely. I may have missed it in the discussion, but has
any analysis been done about:
- the source of the XML (database vs. file)
- the size of the XML
?

If the XML comes from a database it is already in memory, so no worry
about that (unless copies are made because variables are passed by value).

If the XML is pretty small the fastest routine is preferable. Which is
probably the routine which does most of the parsing entirely inside PHP.

One quick fix to lower the memory footprint would be to drop the foreach
or at least use references; otherwise foreach will work on a copy of the
array.

> i don't consider this as off-topic as the caching is one side, the
> optimizing of xml2array is the main reason for this patch :)

Caching can be useful provided the cache hit vs cache miss ratio will be
sufficiently high to compensate for the overhead caused by the caching
mechanism itself.

I am really wondering why there is so much conversion between XML and
arrays taking place? Is it really an efficient way to store so much data
in XML structures in a database? If you use a flexform element in a BE
form for editing a record the data is stored as an XML structure. How can
you efficiently build a query to search inside that data?

If a lot of XML2array and array2XML calls are used to simply use the DS/TO
data to render FE content one could ask if there isn't a more efficient
way to store the data. The editor could still use an XML structure for
customizing DS/TO data, but maybe it's more efficient to use for example a
serialized array as internal storage format?

I was just thinking aloud, but sometimes ideas lead to other ideas  :-)

Regards,

-- 
Jigal van Hemert.



More information about the TYPO3-team-templavoila mailing list