type-hinted hiccup

This commit is contained in:
Chris Allen 2013-01-30 13:41:05 -08:00
parent db3942f934
commit 27ab754387
2 changed files with 22 additions and 0 deletions

View file

@ -31,6 +31,13 @@ Units are in microseconds (us)
<td>24,000 us / 2900 us</td>
</tr>
<tr>
<td>hiccup (type-hinted)</td>
<td>0.335 us / 0.013 us</td>
<td>25 us / 0.431 us</td>
<td>498 us / 6.2 us</td>
</tr>
<tr>
<td>clabango (string)</td>
<td>329 us / 5.7 us</td>

View file

@ -29,6 +29,13 @@
(hiccup/html [:ul (for [x (range 1 ceil)]
[:li x])]))
(defn simple-hiccup-hint []
(hiccup/html [:span {:class "foo"} ^String bar]))
(defn list-hiccup-hint [ceil]
(hiccup/html [:ul (for [x (range 1 ceil)]
[:li ^Number x])]))
(defn simple-clabango-no-fd []
(render (str "<span class=\"foo\">{{bar}}</span>") {:bar bar}))
@ -99,6 +106,14 @@
(with-progress-reporting (quick-bench (list-hiccup 1000)))
(println "\n --- \n")
(println "\n\n ***** type-hinted hiccup benchmarks ***** \n\n")
(with-progress-reporting (quick-bench (simple-hiccup-hint)))
(println "\n --- \n")
(with-progress-reporting (quick-bench (list-hiccup-hint 50)))
(println "\n --- \n")
(with-progress-reporting (quick-bench (list-hiccup-hint 1000)))
(println "\n --- \n")
(println "\n\n ***** clabango string ***** \n\n")
(quick-bench (simple-clabango-no-fd))
(println "\n --- \n")