Liking cljdoc? Tell your friends :D

Benchmarks

The benchmarks compare html-pieces with libraries that do the same jobs, on the JVM and in Node. The libraries don't give the same output, e.g. the sanitizers keep different elements and jsoup's text has no line breaks, so take the numbers as a rough guide. A bundle's size is what the library adds to a minified browser app, gzipped. For a ClojureScript library, that's an app which already uses the collections of cljs.core, as most do.

Time per callhtml-piecesOthers
Parse to a tree, JVM270 µshickory 380 µs, clj-tagsoup 1.43 ms
Parse to a tree, Node384 µsparse5 325 µs, htmlparser2 132 µs
Sanitise HTML, JVM414 µsjsoup 324 µs, OWASP 182 µs
Sanitise HTML, Node761 µssanitize-html 395 µs
HTML to text, JVM458 µsjsoup 128 µs
HTML to text, Node770 µshtml-to-text 526 µs
HTML to Markdown, JVM542 µsflexmark 1.09 ms, copy_down 9.41 ms
HTML to Markdown, Node973 µsturndown 1.37 ms
Hiccup to HTML, JVM132 µshiccup 64.3 µs, huff 739 µs, replicant 121 µs
Hiccup to HTML, Node334 µsreplicant 554 µs
Allocated per callhtml-piecesOthers
Parse to a tree, JVM546 KBhickory 1.15 MB, clj-tagsoup 4.33 MB
Sanitise HTML, JVM946 KBjsoup 351 KB, OWASP 192 KB
HTML to text, JVM1.19 MBjsoup 162 KB
HTML to Markdown, JVM1.30 MBflexmark 691 KB, copy_down 6.87 MB
Hiccup to HTML, JVM387 KBhiccup 413 KB, huff 1.69 MB, replicant 439 KB
BundleAdded, gzipped
html-pieces, parse15.2 KB
html-pieces, hiccup17.5 KB
html-pieces, markdown19.2 KB
html-pieces, every function20.6 KB
hickory2.92 KB
parse540.3 KB
DOMPurify11.3 KB
sanitize-html56.8 KB
turndown3.94 KB

The numbers are for the 11.1 KB article in bench/fixtures. They were measured on 2026-10-09, on an Apple M1 with OpenJDK 64-Bit Server VM 24.0.1, Clojure 1.12.5 and Node v24.1.0.

To run the benchmarks yourself, see Development in the README.

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close