diff --git a/README.md b/README.md
index eeadb19..ba2526e 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,9 @@ I decided to do some decent Clojure templating benchmarks:
Test results are avg / standard deviation.
## Data
+
+Units are in microseconds (us)
+
@@ -15,27 +18,27 @@ Test results are avg / standard deviation.
str |
- 165 ns / 16 ns |
- 14 us / 253 ns |
+ 165 us / .016 us |
+ 14 us / 0.253 us |
273 us / 14 us |
hiccup |
- 20 us / 367 ns |
- 1.1 ms / 59 us |
- 24 ms / 2.9 ms |
+ 20 us / 0.367 us |
+ 1100 us / 59 us |
+ 24,000 us / 2900 us |
clabango (string) |
329 us / 5.7 us |
- 1.8 ms / 146 us |
- 20.6 us / 799 us |
+ 1800 us / 146 us |
+ 20,600 ms / 799 us |
clabango (files) |
478 us / 42 us |
- 1.79 ms / 52 us |
- 19.9 ms / 573 us |
+ 1,790 us / 52 us |
+ 19,900 us / 573 us |
stencil (string) |
@@ -46,7 +49,7 @@ Test results are avg / standard deviation.
stencil (file) |
1.2 us / 22 us |
- 38 us / 943 ns |
+ 38 us / 0.943 us |
784 us / 16 us |
diff --git a/project.clj b/project.clj
index a3da69e..dc3ad18 100644
--- a/project.clj
+++ b/project.clj
@@ -9,4 +9,4 @@
[hiccup "1.0.2"]
[clabango "0.4"]
[stencil "0.3.0"]
- ])
+ [tinsel "0.4.0"]])
diff --git a/src/clojure_template_benchmarks/core.clj b/src/clojure_template_benchmarks/core.clj
index 9862924..f35cdac 100644
--- a/src/clojure_template_benchmarks/core.clj
+++ b/src/clojure_template_benchmarks/core.clj
@@ -1,8 +1,9 @@
(ns clojure-template-benchmarks.core
(:use criterium.core
- hiccup.core)
+ tinsel.core)
(:require [clabango.parser :refer [render render-file]]
- [stencil.core :as stencil]))
+ [stencil.core :as stencil]
+ [hiccup.core :as hiccup]))
(def bar (str "bar"))
@@ -20,10 +21,10 @@
(defn simple-hiccup []
- (html [:span {:class "foo"} bar]))
+ (hiccup/html [:span {:class "foo"} bar]))
(defn list-hiccup [ceil]
- (html [:ul (for [x (range 1 ceil)]
+ (hiccup/html [:ul (for [x (range 1 ceil)]
[:li x])]))
@@ -55,56 +56,76 @@
(stencil/render-file "clojure_template_benchmarks/templates/list.mustache" {:items (range 1 ceil)}))
+(deftemplate simple-tinsel [[:span {:class "foo"}]]
+ []
+ (set-content bar))
+
+(deftemplate list-tinsel [[:ul]]
+ [ceil]
+ (set-content (for [x (range 1 ceil)]
+ [:li x])))
+
+
(defn -main [& args]
;; (println (simple-hiccup))
;; (println (simple-clabango-no-fd))
;; (println (count (list-filler-hiccup)))
;; (println (count (list-filler-clabango-no-fd)))
- (println "\n\n ***** str benchmarks ***** \n\n")
- (with-progress-reporting (quick-bench (simple-str)))
- (println "\n --- \n")
- (with-progress-reporting (quick-bench (list-str 50)))
- (println "\n --- \n")
- (with-progress-reporting (quick-bench (list-str 1000)))
- (println "\n --- \n")
+ ;; (println "\n\n ***** str benchmarks ***** \n\n")
+ ;; (with-progress-reporting (quick-bench (simple-str)))
+ ;; (println "\n --- \n")
+ ;; (with-progress-reporting (quick-bench (list-str 50)))
+ ;; (println "\n --- \n")
+ ;; (with-progress-reporting (quick-bench (list-str 1000)))
+ ;; (println "\n --- \n")
- (println "\n\n ***** hiccup benchmarks ***** \n\n")
- (with-progress-reporting (quick-bench (simple-hiccup)))
- (println "\n --- \n")
- (with-progress-reporting (quick-bench (list-hiccup 50)))
- (println "\n --- \n")
- (with-progress-reporting (quick-bench (list-hiccup 1000)))
- (println "\n --- \n")
+ ;; (println "\n\n ***** hiccup benchmarks ***** \n\n")
+ ;; (with-progress-reporting (quick-bench (simple-hiccup)))
+ ;; (println "\n --- \n")
+ ;; (with-progress-reporting (quick-bench (list-hiccup 50)))
+ ;; (println "\n --- \n")
+ ;; (with-progress-reporting (quick-bench (list-hiccup 1000)))
+ ;; (println "\n --- \n")
- (println "\n\n ***** clabango string ***** \n\n")
- (quick-bench (simple-clabango-no-fd))
- (println "\n --- \n")
- (quick-bench (list-clabango-no-fd 50))
- (println "\n --- \n")
- (quick-bench (list-clabango-no-fd 1000))
- (println "\n --- \n")
+ ;; (println "\n\n ***** clabango string ***** \n\n")
+ ;; (quick-bench (simple-clabango-no-fd))
+ ;; (println "\n --- \n")
+ ;; (quick-bench (list-clabango-no-fd 50))
+ ;; (println "\n --- \n")
+ ;; (quick-bench (list-clabango-no-fd 1000))
+ ;; (println "\n --- \n")
- (println "\n\n ***** clabango from file template ***** \n\n")
- (with-progress-reporting (quick-bench (simple-clabango)))
- (println "\n --- \n")
- (with-progress-reporting (quick-bench (list-clabango 50)))
- (println "\n --- \n")
- (with-progress-reporting (quick-bench (list-clabango 1000)))
- (println "\n --- \n")
+ ;; (println "\n\n ***** clabango from file template ***** \n\n")
+ ;; (with-progress-reporting (quick-bench (simple-clabango)))
+ ;; (println "\n --- \n")
+ ;; (with-progress-reporting (quick-bench (list-clabango 50)))
+ ;; (println "\n --- \n")
+ ;; (with-progress-reporting (quick-bench (list-clabango 1000)))
+ ;; (println "\n --- \n")
- (println "\n\n ***** stencil string ***** \n\n")
- (with-progress-reporting (quick-bench (simple-stencil-no-fd)))
- (println "\n --- \n")
- (with-progress-reporting (quick-bench (list-stencil-no-fd 50)))
- (println "\n --- \n")
- (with-progress-reporting (quick-bench (list-stencil-no-fd 1000)))
- (println "\n --- \n")
+ ;; (println "\n\n ***** stencil string ***** \n\n")
+ ;; (with-progress-reporting (quick-bench (simple-stencil-no-fd)))
+ ;; (println "\n --- \n")
+ ;; (with-progress-reporting (quick-bench (list-stencil-no-fd 50)))
+ ;; (println "\n --- \n")
+ ;; (with-progress-reporting (quick-bench (list-stencil-no-fd 1000)))
+ ;; (println "\n --- \n")
- (println "\n\n ***** stencil file ***** \n\n")
- (with-progress-reporting (quick-bench (simple-stencil)))
+ ;; (println "\n\n ***** stencil file ***** \n\n")
+ ;; (with-progress-reporting (quick-bench (simple-stencil)))
+ ;; (println "\n --- \n")
+ ;; (with-progress-reporting (quick-bench (list-stencil 50)))
+ ;; (println "\n --- \n")
+ ;; (with-progress-reporting (quick-bench (list-stencil 1000)))
+ ;; (println "\n --- \n")
+
+ (println (simple-tinsel))
+ (println (list-tinsel 50))
+ (println "\n\n ***** tinsel ***** \n\n")
+ (with-progress-reporting (quick-bench (simple-tinsel)))
(println "\n --- \n")
- (with-progress-reporting (quick-bench (list-stencil 50)))
+ (with-progress-reporting (quick-bench (list-tinsel 50)))
(println "\n --- \n")
- (with-progress-reporting (quick-bench (list-stencil 1000)))
+ (with-progress-reporting (quick-bench (list-tinsel 1000)))
(println "\n --- \n"))