Today I did some code optimization, cleanup and refactoring. Result of that was TG_XmlNode.getElementsByTagName() was optimized to consume lesser script statements. I was able to reduce the script consumption upto 50%, by in-lining many statements and adding few checks.
Together with this I added a bench marking class “TG_XMLDOM_BenchMarks.cls”. This can be used to quickly bench mark XmlDom vs Fast Xml DOM on different xml samples.
How to use bench marking
Open “TG_XMLDOM_BenchMarks.cls”
Locate static string variable named “XML_URL” to public URL of your XML sample. Together with this, you need to white list domain for this url via “Setup > Security Controls > Remote Site Settings”.
Call “TG_XMLDOM_BenchMarks.benchmark()” to start benchmarking.
// Just call this method TG_XMLDOM_BenchMarks.benchmark();
Check the debug logs, the results will be logged with Logging Level of INFO. Sample shown below:
INFO|XmlDom.constructor() -> Scripts Used : 4804 ,time consumed : 264 INFO|TG_XmlDom.constructor() -> Scripts Used : 26 ,time consumed : 18
Comments (2)
Anonymoussays:
March 4, 2013 at 10:54 pmHi Abhinav,Thanks for this great library.I am planing to use this in one of my project .What about license of the code.?
Anonymoussays:
March 5, 2013 at 3:08 amThanks Ravi, The library follows this license through out : http://opensource.org/licenses/bsd-license.phpThe same is suggested in Salesforce Code Share guidelines as well, more details here: http://wiki.developerforce.com/page/Creating_a_Code_Share_Project