Hiccup is a library for generating a string of HTML from a tree of
Clojure vectors. It supports dynamically generating HTML, but since
0.2.0 it statically compiles and optimizes where possible. This makes
Hiccup very, very fast. Under some circumstances, it even outperforms
clj-html.

Here are some recent benchmarks for generating 100,000 HTML pages:

clj-html                 - 4936ms
hiccup                   - 1455ms
hiccup (with type hints) - 1252ms
str with string literals - 1216ms

I've put the benchmark code and more detailed results up as a gist:
http://gist.github.com/326028

In the interests of fairness I should note that clj-html performs 17%
faster than Hiccup if we replace this:

[:ul.times-table
  (for [n (range 1 13)]
    [:li n " * 9 = " (* n 9)])]

With this somewhat lengthier code:

[:ul.times-table
  (apply str
    (for [n (range 1 13)]
      (clj-html/html [:li n " * 9 = " (* n 9)])]

Hiccup generates this optimization itself, which is probably why it's
out-performing clj-html in this case.

The current released version of Hiccup is 0.2.1. I was planning on
making a post at 0.2.0, but by the time I got around to it, I had
enough commits to make another patch version.

- James

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to