Whats faster? simplexml_load_string or simplexml_load_file?

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-09-2008
Lamonte
 
Posts: n/a
Default Whats faster? simplexml_load_string or simplexml_load_file?

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" ?
Reply With Quote
  #2 (permalink)  
Old 03-09-2008
petersprc
 
Posts: n/a
Default Re: Whats faster? simplexml_load_string or simplexml_load_file?

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" ?


Reply With Quote
  #3 (permalink)  
Old 03-10-2008
Daniel Brown
 
Posts: n/a
Default Re: [PHP] Whats faster? simplexml_load_string or simplexml_load_file?

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); } ?>
Reply With Quote
  #4 (permalink)  
Old 03-11-2008
Lamonte H
 
Posts: n/a
Default Re: Whats faster? simplexml_load_string or simplexml_load_file?

Daniel Brown <parasane <at> gmail.com> writes:

> snipped


It worked like a charm, thanks. Made it a bit faster.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:50 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0