# Template Engine Performance Comparison #### Ruby implementations. ## Competitors - ERB - Erubis - Haml - Liquid - Mustache - Slim ... and our special guest ... - String interpolation ## Running ```bash # Prepare workspace git clone git@github.com:localhots/template_engine_comparison.git cd template_engine_comparison bundle install # Generate data for templates ./fakedata.rb 1000 > data/big.yml # Run benchmarks ./benchmark.rb ``` ## Current Results **Intel Core i7 2.6 GHz** ``` ############################################################ ## Compilation (small) (1000 runs) ## ############################################################ user system total real string 0.040000 0.020000 0.060000 ( 0.053855) erubis 0.060000 0.010000 0.070000 ( 0.075751) erb 0.240000 0.030000 0.270000 ( 0.262077) haml 0.840000 0.020000 0.860000 ( 0.865688) slim 1.930000 0.040000 1.970000 ( 1.968993) mustache 0.020000 0.010000 0.030000 ( 0.030289) liquid 0.080000 0.020000 0.100000 ( 0.104174) ############################################################ ## Render (small) (1000 runs) ## ############################################################ user system total real string 0.010000 0.000000 0.010000 ( 0.007824) erubis 0.010000 0.000000 0.010000 ( 0.008019) erb 0.010000 0.000000 0.010000 ( 0.010448) haml 0.020000 0.000000 0.020000 ( 0.019507) slim 0.020000 0.000000 0.020000 ( 0.019644) mustache 0.230000 0.000000 0.230000 ( 0.232938) liquid 0.040000 0.000000 0.040000 ( 0.044189) ############################################################ ## Compilation (big) (1000 runs) ## ############################################################ user system total real string 0.030000 0.020000 0.050000 ( 0.044706) erubis 0.140000 0.020000 0.160000 ( 0.161244) erb 0.320000 0.030000 0.350000 ( 0.341144) haml 1.180000 0.020000 1.200000 ( 1.205595) slim 2.410000 0.040000 2.450000 ( 2.449355) mustache 0.020000 0.010000 0.030000 ( 0.028152) liquid 0.110000 0.020000 0.130000 ( 0.133382) ############################################################ ## Render (big) (100 runs) ## ############################################################ user system total real string 0.390000 0.020000 0.410000 ( 0.408272) erubis 0.440000 0.020000 0.460000 ( 0.457214) erb 0.640000 0.020000 0.660000 ( 0.656181) haml 0.940000 0.020000 0.960000 ( 0.965373) slim 1.390000 0.000000 1.390000 ( 1.395409) mustache 3.770000 0.010000 3.780000 ( 3.778392) liquid 10.460000 0.050000 10.510000 ( 10.507224) ```