This is a discussion on Whats faster? simplexml_load_string or simplexml_load_file? within the PHP General forums, part of the PHP Programming Forums category; I was wondering this because at the moment using simplexml_load_file makes my script go at about 2 seconds per page ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I was wondering this because at the moment using simplexml_load_file
makes my script go at about 2 seconds per page load, in a loop. Then I created a cache system so it doesn't keep loading the xml file, but I'm wondering if theres a faster way to load xml QUICKER, is it possible with "file_get_contents" and "simplexml_load_string" ? |
|
|||
|
It could be slow if the XML file is very large or if it's accessed
remotely instead of locally, or if the server has many users... Eliminating a local file read is not likely to give you any noticeable speedup... On Mar 8, 10:18 pm, php4f...@gmail.com (Lamonte) wrote: > I was wondering this because at the moment using simplexml_load_file > makes my script go at about 2 seconds per page load, in a loop. Then I > created a cache system so it doesn't keep loading the xml file, but I'm > wondering if theres a faster way to load xml QUICKER, is it possible > with "file_get_contents" and "simplexml_load_string" ? |
|
|||
|
On Sat, Mar 8, 2008 at 11:18 PM, Lamonte <php4food@gmail.com> wrote:
> I was wondering this because at the moment using simplexml_load_file > makes my script go at about 2 seconds per page load, in a loop. Then I > created a cache system so it doesn't keep loading the xml file, but I'm > wondering if theres a faster way to load xml QUICKER, is it possible > with "file_get_contents" and "simplexml_load_string" ? Yes, and you may notice performance enhancements because you're now going to parse the XML data line-by-line as opposed to parsing the entire file at once. -- </Dan> Daniel P. Brown Senior Unix Geek <? while(1) { $me = $mind--; sleep(86400); } ?> |