Fast XML DOM vs XmlDom Benchmarks!

Today I got a nice comment about “Fast XML DOM” script consumption being more of Ron Hess’s “XmlDom.cls”. That surprised me, and I thought, Why don’t I give it a try and publish the results?

Benchmarking: Fixture

The most important thing to make benchmarking transparent and easy for everybody to reproduce was to search for a decently big XML document to perform operations on. For this, I decided to pick any public XML Atom feed and decided to use it from a Google Code project feed.

Apart from that, for the first round of benchmarking, I picked two other criteria for benchmarking both APIs. These are

  • Benchmark#1: DOM Creation: This operation is pretty heavy as it involves creating a DOM structure from an XML string.

  • Benchmark#2: getElementsByTagName() API Call: This is a pretty popular and nice API to test how well an XML API performs on parsing XML structure to give matching nodes for a name.

  • Benchmark#3: getElementByTagName() API Call: This API call is similar to the one above. However, its performance depends on the way it is implemented.

To keep this benchmarking process simple and extensive for the future, a new class “TG_XMLDOM_BenchMarks” has been added to the API. You can check it to see how I am benchmarking.

Benchmark#1: DOM Creation

Results:

INFO|XmlDom.constructor() -> Scripts Used : 4804 ,time consumed : 264
INFO|TG_XmlDom.constructor() -> Scripts Used : 26 ,time consumed : 18

Benchmark#2: getElementsByTagName API call

Results:

INFO|XmlDom.getElementsByTagName() -> Scripts Used : 795 ,time consumed : 28
INFO|TG_XmlDom.getElementsByTagName() -> Scripts Used : 560 ,time consumed : 55

Benchmark#3: getElementByTagName API call

Results:

INFO|XmlDom.getElementByTagName() -> Scripts Used : 798 ,time consumed : 27
INFO|TG_XmlDom.getElementByTagName() -> Scripts Used : 38 ,time consumed : 2

I am glad benchmarking started and resulted well. I will be doing more benchmarking in the coming days. This will give Fast XML DOM users/developers more confidence in the API and will help us figure out more areas for polishing and optimizations.

Let’s Talk

CTA Banner - Contact form

Drop a note below to move forward with the conversation 👇🏻

Abhinav Gupta

First Indian Salesforce MVP, rewarded Eight times in a row, has been blogging about Salesforce, Cloud, AI, & Web3 since 2011. Founded 1st Salesforce Dreamin event in India, called “Jaipur Dev Fest”. A seasoned speaker at Dreamforce, Dreamin events, & local meets. Author of many popular GitHub repos featured in official Salesforce blogs, newsletters, and books.

https://abhinav.fyi
Previous
Previous

Apex Library - Fast XML DOM

Next
Next

Fast XML DOM featured in SFDC March 2010’s Newsletter !