You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>The tables and charts were generated by <ahref="https://github.com/css4j/carte">Carte</a> (look for the <code>BenchmarkChartWriter</code>
55
-
class and the <code>examples</code> folder in the <code>carte-jmh</code> module). The grey lines at the top of the bars give the amplitude of the estimated error.</p>
55
+
<p>The tables and charts were generated by <ahref="https://github.com/css4j/carte">Carte</a> (look for
56
+
the <ahref="https://github.com/css4j/carte/blob/master/carte-jmh/src/io/sf/carte/report/jmh/BenchmarkChartWriter.java"><code>BenchmarkChartWriter</code></a>
57
+
class and the <a
58
+
href="https://github.com/css4j/carte/tree/master/carte-jmh/examples"><code>examples</code></a> folder in
59
+
the <code>carte-jmh</code> module, especially the <a
configuration file). The grey lines at the top of the bars give the amplitude of the estimated error.</p>
56
62
<p>The computer has an Intel® Core™ i5-1035G7 CPU and 8GB of RAM. Unfortunately, being a laptop processor it is affected by thermal management,
57
63
which may explain some relatively large error intervals.</p>
58
64
<pid="jdk_note" class="note">(*) Note: one of the tested DOM implementations is the one that comes bundled with the JDK (identified as "JDK" in the graphics), and it has been observed
@@ -62,6 +68,7 @@ <h2>Overview</h2>
62
68
<h2>Build HTML documents</h2>
63
69
<p>Measures the speed at which the <ahref="https://about.validator.nu/htmlparser/">validator.nu HTML parser</a> can parse a small document (38 KB HTML) into a few DOM implementations.
64
70
As a reference, they are compared to the same document parsed by Jsoup.</p>
<p>Count the nodes of a 38kB XHTML document, using a combination of <code><ahref="https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/Node.html#getFirstChild()">getFirstChild()</a>/<ahref="https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/Node.html#getNextSibling()">getNextSibling()</a></code> to traverse it.</p>
<p>Count the nodes of a 38kB XHTML document, using a combination of <code><ahref="https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/Node.html#getLastChild()">getLastChild()</a>/<ahref="https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/Node.html#getPreviousSibling()">getPreviousSibling()</a></code> to traverse it.</p>
<p>Count the nodes of an XML document, using a combination of <code><ahref="https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/Node.html#getFirstChild()">getFirstChild()</a>/<ahref="https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/Node.html#getNextSibling()">getNextSibling()</a></code> to traverse it.</p>
<p>Count the nodes of an XML document, using a combination of <code><ahref="https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/Node.html#getLastChild()">getLastChild()</a>/<ahref="https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/Node.html#getPreviousSibling()">getPreviousSibling()</a></code> to traverse it.</p>
<p>Count the elements of a 38kB XHTML document traversed by a <ahref="https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/traversal/NodeIterator.html"><code>NodeIterator</code></a>.</p>
<p>Count the elements of an XML document traversed by a <ahref="https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/traversal/NodeIterator.html"><code>NodeIterator</code></a>.</p>
<p>Count the elements of a 38kB XHTML document traversed by a <ahref="https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/traversal/TreeWalker.html"><code>TreeWalker</code></a>.</p>
<p>Count the elements of an XML document traversed by a <ahref="https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/traversal/TreeWalker.html"><code>TreeWalker</code></a>.</p>
<p>Traverse a 38kB XHTML document using native DOM's iterable <ahref="https://css4j.github.io/api/latest/io.sf.carte.css4j/io/sf/carte/doc/dom/DOMNode.html#getChildNodes()"><code>getChildNodes()</code></a>,
1066
1083
DOM4J's <ahref="https://dom4j.github.io/javadoc/2.1.4/org/dom4j/Branch.html#nodeIterator--"><code>nodeIterator()</code></a> and Jsoup's
<p>Traverse an XML document using native DOM's iterable <ahref="https://css4j.github.io/api/latest/io.sf.carte.css4j/io/sf/carte/doc/dom/DOMNode.html#getChildNodes()"><code>getChildNodes()</code></a>
1152
1170
and DOM4J's <ahref="https://dom4j.github.io/javadoc/2.1.4/org/dom4j/Branch.html#nodeIterator--"><code>nodeIterator()</code></a>.</p>
<p>Traverse a 38kB XHTML document using native DOM's <ahref="https://css4j.github.io/api/latest/io.sf.carte.css4j/io/sf/carte/doc/dom/ParentNode.html#elementIterator()"><code>elementIterator()</code></a>,
1237
1256
DOM4J's <ahref="https://dom4j.github.io/javadoc/2.1.4/org/dom4j/Element.html#elementIterator--"><code>elementIterator()</code></a> and Jsoup's
<p>Traverse an XML document using native DOM's <ahref="https://css4j.github.io/api/latest/io.sf.carte.css4j/io/sf/carte/doc/dom/ParentNode.html#elementIterator()"><code>elementIterator()</code></a>
1323
1343
and DOM4J's <ahref="https://dom4j.github.io/javadoc/2.1.4/org/dom4j/Element.html#elementIterator--"><code>elementIterator()</code></a>.</p>
<p>Traverse the list given by <code>getElementsByTagName()</code>, this time from a 1MB document. Again, for css4j's native DOM there are two results: one iterating the
1520
1542
<ahref="https://dom.spec.whatwg.org/#interface-nodelist"><code>NodeList</code></a> by the <code>item()</code> method, and another via the iterator
1521
1543
(the returned <code>NodeList</code> implements <ahref="https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html"><code>Iterable</code></a>).</p>
<p>Modify the nodes of an XML document by appending elements with <ahref="https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/Node.html#appendChild(org.w3c.dom.Node)"><code>appendChild()</code></a> and later removing them with
0 commit comments