|
Elvis McNeely - 2008-05-24 01:55:16
Thank you for this class. Forgive me for the following questions, I am still learning.
First, I want to ask, when on PHP5 does PHP5's simpleXML kick in or your class? I didn't see any code checking for the PHP version used.
Does your class support the "xpath" feature similar to SimpleXML? Example 7:
us2.php.net/manual/en/simplexml.exa ...
And, does your class support wildcards? Also mentioned in Example 7.
If those are supported features how would I go about implementing them?
Thanks in advance.
Taha Paksu - 2008-05-24 12:32:00 - In reply to message 1 from Elvis McNeely
First, there's no function to check the PHP version. You can do it yourself. And this script does not support xpath and wildcards. it only parses the xml document and gives you the array of it. You can use the array functions to make things work based on the result array.
Elvis McNeely - 2008-05-24 17:38:06 - In reply to message 2 from Taha Paksu
Thanks for the response. So your class outputs the same on either environment, PHP4 or PHP5? I am working in PHP5 right now and want to write my code to work in either environment.
Also, have you done any benchmarking with your class against say PHP5's simplexml? It would be nice to see that, many PHP developers are telling me not to support PHP4. But if your class is comparable to PHP5's simplexml speed then I would rather go with your class.
Regards
Taha Paksu - 2008-05-24 19:45:40 - In reply to message 3 from Elvis McNeely
The simplexml is a little better with normal standart xml ( > 200 nodes ) files (I tested with Zend Profiler and there's a ratio 6/5 which simplexml is better) and i tested only once with a large file ( ~= 17000 nodes) and I optimized the script with that. If you want to do some benchmark tests with your own techniques, that'd be good..
Elvis McNeely - 2008-05-24 21:42:24 - In reply to message 4 from Taha Paksu
I did some some tests of my own, although I am not sure I did them the standard way. The xml file I am working with has 665 elements, and 568 attributes throughout. I ran the output in a for() loop 100 times and measured the time with mircotime(). The time measured was from the browser end (loading the test file from the browser).
I am testing in PHP5, not PHP4, and the test was ran on a WAMP setup. Here are the results - for 5 runs:
SimpleXML Class
=================
39.083903074265
39.452807188034
40.196016073227
39.477373838425
39.659987926483
===============
Avg: 39.57401762 seconds
PHP5's simpleXML
==================
39.562291145325
39.054084062576
38.936517000198
38.405164003372
38.329798936844
===============
Avg: 38.85757103 seconds
Under these contraints the SimpleXML class ran just 1.81% slower, very good if you ask me. None of the xml files I will be hitting are nearly this large (1233 nodes x 100 loops). But, it is good to know this info. My main concern was this class would run much slower in the PHP5 environment. I tested another parser the other day under these constraints and it was about 1.8 times slower than PHP5's simplexml. So the above tests are encouraging for what I am wanting to do. Now on to PHP4 benchmarking.
Hopefully someone else will find this useful. If there is a better way to benchmark please let me know.
Taha Paksu - 2008-05-24 21:53:38 - In reply to message 5 from Elvis McNeely
Thank you so much. I'll put this results in a file in this package :) And if you test it with php4 i'll put them too. of course with your permission.
Taha Paksu - 2008-05-24 22:09:40 - In reply to message 6 from Taha Paksu
and there's a benchmarking PERL package you can find in PERL repository. I don't have time and resources to test it now but if you won't i'll do that testing in a couple of days later myself. Thanks again for offering some benchmark testing to this class.
|