From 27ab75438756d4876f90f25b8688d44c66ecbb66 Mon Sep 17 00:00:00 2001 From: Chris Allen Date: Wed, 30 Jan 2013 13:41:05 -0800 Subject: [PATCH] type-hinted hiccup --- README.md | 7 +++++++ src/clojure_template_benchmarks/core.clj | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/README.md b/README.md index f0fcec0..edb6c48 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,13 @@ Units are in microseconds (us) 24,000 us / 2900 us + + hiccup (type-hinted) + 0.335 us / 0.013 us + 25 us / 0.431 us + 498 us / 6.2 us + + clabango (string) 329 us / 5.7 us diff --git a/src/clojure_template_benchmarks/core.clj b/src/clojure_template_benchmarks/core.clj index 09f8be7..beaff70 100644 --- a/src/clojure_template_benchmarks/core.clj +++ b/src/clojure_template_benchmarks/core.clj @@ -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 "{{bar}}") {: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")