2013-01-30 02:25:33 -05:00
|
|
|
# clojure-template-benchmarks
|
|
|
|
|
2013-01-30 02:30:18 -05:00
|
|
|
I decided to do some decent Clojure templating benchmarks:
|
2013-01-30 02:25:33 -05:00
|
|
|
|
2013-01-30 02:35:36 -05:00
|
|
|
Test results are avg / standard deviation.
|
2013-01-30 02:25:33 -05:00
|
|
|
|
2013-01-30 02:35:36 -05:00
|
|
|
## Data
|
2013-01-30 03:07:29 -05:00
|
|
|
|
2013-07-19 16:57:04 -04:00
|
|
|
The unit 'us' is microseconds. Typical bullshit "ran this on my macbook" arrangement. Run it on your own thing if you care.
|
2013-01-30 03:07:29 -05:00
|
|
|
|
2013-01-30 02:30:18 -05:00
|
|
|
<table>
|
2013-01-30 02:25:33 -05:00
|
|
|
|
2013-01-30 02:30:18 -05:00
|
|
|
<tr>
|
|
|
|
<th>Template Engine</th>
|
|
|
|
<th>Simple Data Injection</th>
|
2013-01-30 02:35:36 -05:00
|
|
|
<th>Small List (50 items)</th>
|
|
|
|
<th>Big List (1000 items)</th>
|
2013-01-30 02:30:18 -05:00
|
|
|
</tr>
|
2013-01-30 03:29:43 -05:00
|
|
|
|
2013-01-30 02:30:18 -05:00
|
|
|
<tr>
|
|
|
|
<td>str</td>
|
2013-07-19 16:57:04 -04:00
|
|
|
<td>0.365 us / 0.002 us</td>
|
|
|
|
<td>29 us / 0.220 us</td>
|
|
|
|
<td>572 us / 2 us</td>
|
2013-01-30 02:30:18 -05:00
|
|
|
</tr>
|
2013-01-30 03:29:43 -05:00
|
|
|
|
2013-01-30 02:30:18 -05:00
|
|
|
<tr>
|
|
|
|
<td>hiccup</td>
|
2013-07-19 16:57:04 -04:00
|
|
|
<td>0.673 us / 0.006 us</td>
|
|
|
|
<td>35 us / 1 us</td>
|
|
|
|
<td>682 us / 3 us</td>
|
2013-01-30 02:30:18 -05:00
|
|
|
</tr>
|
2013-01-30 03:29:43 -05:00
|
|
|
|
2013-01-30 16:41:05 -05:00
|
|
|
<tr>
|
|
|
|
<td>hiccup (type-hinted)</td>
|
2013-07-19 16:58:27 -04:00
|
|
|
<td>Identical to or slower than non-type-hinted hiccup.</td>
|
2013-07-19 16:57:04 -04:00
|
|
|
<!-- <td>0.335 us / 0.013 us</td>
|
2013-01-30 16:41:05 -05:00
|
|
|
<td>25 us / 0.431 us</td>
|
2013-07-19 16:57:04 -04:00
|
|
|
<td>498 us / 6.2 us</td> -->
|
2013-01-30 16:41:05 -05:00
|
|
|
</tr>
|
|
|
|
|
2013-01-30 02:30:18 -05:00
|
|
|
<tr>
|
|
|
|
<td>clabango (string)</td>
|
2013-07-19 16:57:04 -04:00
|
|
|
<td>544 us / 6.7 us</td>
|
|
|
|
<td>2452 us / 17 us</td>
|
|
|
|
<td>30,000 us / 193 us</td>
|
2013-01-30 02:30:18 -05:00
|
|
|
</tr>
|
2013-01-30 03:29:43 -05:00
|
|
|
|
2013-01-30 02:30:18 -05:00
|
|
|
<tr>
|
|
|
|
<td>clabango (files)</td>
|
2013-07-19 16:57:04 -04:00
|
|
|
<td>665 us / 8.7 us</td>
|
|
|
|
<td>2,617 us / 22 us</td>
|
|
|
|
<td>30,450 us / 390 us</td>
|
2013-01-30 02:30:18 -05:00
|
|
|
</tr>
|
2013-01-30 03:29:43 -05:00
|
|
|
|
2013-01-30 02:50:49 -05:00
|
|
|
<tr>
|
|
|
|
<td>stencil (string)</td>
|
2013-07-19 16:57:04 -04:00
|
|
|
<td>90 us / 0.5 us</td>
|
|
|
|
<td>290 us / 2.7 us</td>
|
|
|
|
<td>1,300 us / 13 us</td>
|
2013-01-30 02:50:49 -05:00
|
|
|
</tr>
|
2013-01-30 03:29:43 -05:00
|
|
|
|
2013-01-30 02:50:49 -05:00
|
|
|
<tr>
|
|
|
|
<td>stencil (file)</td>
|
2013-07-19 16:57:04 -04:00
|
|
|
<td>2.2 us / 0.019 us</td>
|
|
|
|
<td>58 us / 0.465 us</td>
|
|
|
|
<td>1,148 us / 10 us</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td>mustache.clj (file)</td>
|
|
|
|
<td>0.947 us / 0.006 us</td>
|
|
|
|
<td>26 us / 0.206 us</td>
|
|
|
|
<td>541 us / 4.7 us</td>
|
2013-01-30 02:50:49 -05:00
|
|
|
</tr>
|
2013-01-30 03:29:43 -05:00
|
|
|
|
2013-01-30 03:22:09 -05:00
|
|
|
<tr>
|
|
|
|
<td>tinsel</td>
|
2013-07-19 16:57:04 -04:00
|
|
|
<td>0.678 us / 0.006 us</td>
|
|
|
|
<td>34 us / 0.175 us</td>
|
|
|
|
<td>679 us / 7.1 us</td>
|
2013-01-30 03:22:09 -05:00
|
|
|
</tr>
|
2013-01-30 02:25:33 -05:00
|
|
|
|
2013-01-30 12:15:37 -05:00
|
|
|
<tr>
|
|
|
|
<td>laser</td>
|
2013-07-19 16:57:04 -04:00
|
|
|
<td>404 us / 9.4 us</td>
|
|
|
|
<td>3,770 us / 26 us</td>
|
|
|
|
<td>68,000 us / 925 us</td>
|
2013-01-30 12:15:37 -05:00
|
|
|
</tr>
|
|
|
|
|
2013-02-20 02:05:47 -05:00
|
|
|
<tr>
|
|
|
|
<td>laser (type-hinted)</td>
|
2013-07-19 16:57:04 -04:00
|
|
|
<td>401 us / 3.1 us</td>
|
|
|
|
<td>3,764 us / 18 us</td>
|
|
|
|
<td>69,408 us / 1,028 us</td>
|
2013-02-20 02:05:47 -05:00
|
|
|
</tr>
|
|
|
|
|
2013-01-30 12:15:37 -05:00
|
|
|
<tr>
|
|
|
|
<td>enlive</td>
|
2013-07-19 16:57:04 -04:00
|
|
|
<td>47 us / 0.397 us</td>
|
|
|
|
<td>385 us / 8.5 us</td>
|
|
|
|
<td>6,800 us / 51 us</td>
|
2013-01-30 12:15:37 -05:00
|
|
|
</tr>
|
|
|
|
|
2013-01-30 02:30:18 -05:00
|
|
|
</table>
|
|
|
|
|
2013-01-30 02:35:36 -05:00
|
|
|
## Conclusions
|
2013-01-30 02:30:18 -05:00
|
|
|
|
2013-07-19 17:01:19 -04:00
|
|
|
+ (str ...), Mustache.clj, Tinsel, and Hiccup are all fast.
|
|
|
|
+ Raynes wasn't paying attention when he refactored laser. :P
|
|
|
|
+ Enlive hasn't changed at all.
|
|
|
|
+ Stencil seems less impressive than it used to, but it's still faster than most options.
|
|
|
|
+ Clabango has gotten worse.
|
|
|
|
|
2013-01-30 02:30:18 -05:00
|
|
|
Copyright © 2013 bitemyapp
|