|
Posted by Adam Harvey on 12/07/06 01:14
On Wed, 06 Dec 2006 09:09:02 -0800, CptDondo wrote:
>> If this is no option for you, you might try a 'shared memory' approach in
>> PHP.
>> Here is more info:
>> http://nl3.php.net/manual/en/ref.shmop.php
>
> I may follow up on that in V2. :-) It looks interesting; I don't know
> if we can shove a $dom in there and retrieve it.
If you're feeling particularly adventurous, another potential approach
would be to write a PHP extension (in C, that is) that loads and parses
the XML file on module initialisation (effectively when the Web server
starts, assuming I'm right in remembering that you were using FastCGI),
stashing the parsed DOM somewhere, then creating a function or class to
access it from within each script.
What I don't know is exactly how you'd go about the XML parsing, since
I've never developed an extension that has to do that. I suspect you'd
have to use libxml2 directly for at least the initial parsing, and you'd
probably have to persist a libxml2 xmlDoc between requests rather than a
PHP object. The hard part's likely to be writing the function for
script-level access, since you're going to need to hook into ext/domxml to
create the DomDocument object for the PHP script to use.
It sounds like overkill to me, honestly, but given the power limitations
you're dealing with, it may be an option to look at if you need to save
every last cycle.
Adam
--
Adam Harvey
To e-mail: don't make an example out of me!
Navigation:
[Reply to this message]
|