note 87853 deleted from function.simplexml-element-asXML by danbrown
| From: | danbrown@php.net | Date: | Fri, 26 Dec 2008 22:19:04 +0000 |
| Subject: | note 87853 deleted from function.simplexml-element-asXML by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-148550@lists.php.net to get a copy of this message | ||
Note Submitter: Ian Zepp
----
For generating XML, SimpleXML may not be the best choice, depending on your performance
requirements:
I needed to create a context stream (such as "logging://info") in order to push logging
messages from a PHP webserver to an Enterprise Service Bus for routing and auditing. Since this is
logging, high-traffic is expected and high performance XML generation is required. Unfortunately,
SimpleXML just was not up to the task, although not nearly as back as using the XML_Serializer
library.
Detailed benchmarking results:
The results are summarized below:
Executing Heredoc Interpolation Test : ......... 0.00376201 ms/iter.
Executing String Concatenation Test : ......... 0.00410941 ms/iter.
Executing String Interpolation Test : ......... 0.00474050 ms/iter.
Executing Output Buffering Test : ......... 0.00430031 ms/iter.
Executing Output Buffering Include Test : ......... 0.04734261 ms/iter.
Executing SimpleXML Element Test : ......... 0.02940309 ms/iter.
Executing Indented SimpleXML Element Test : ......... 0.07175908 ms/iter.
Executing XML Serializer Test : ......... 0.38576980 ms/iter.
Executing CachedXML Serializer Test : ......... 0.37935431 ms/iter.
Executing DOM Document Test : ......... 0.04152939 ms/iter.
Completed 10 test cases of 10000 iterations each.
real 0m9.746s
user 0m9.593s
sys 0m0.132s
izepp@izepp-desktop:~/Desktop$
You can find the full source code for this performance test at:
http://www.ianzepp.com/engineering/2008/12/
a-comprehensive-review-of-string-xml-performance.html