1
0

Adjust benchmarks, prettify results

This commit is contained in:
Gregory Eremin 2013-12-14 04:21:46 +07:00
parent 89467c5c67
commit 5940fce015
2 changed files with 48 additions and 48 deletions

View File

@ -34,58 +34,58 @@ bundle install
``` ```
############################################################ ############################################################
## Compilation (small) (1000 runs) ## ## Compilation (small template) - 1.000 runs ##
############################################################ ############################################################
user system total real user system total real
string 0.030000 0.020000 0.050000 ( 0.046353) string 0.020000 0.020000 0.040000 ( 0.043484)
erubis 0.060000 0.020000 0.080000 ( 0.079977) erubis 0.060000 0.020000 0.080000 ( 0.079481)
erb 0.260000 0.020000 0.280000 ( 0.273492) erb 0.250000 0.020000 0.270000 ( 0.266557)
haml 0.850000 0.020000 0.870000 ( 0.874163) haml 0.850000 0.030000 0.880000 ( 0.879533)
slim 1.970000 0.040000 2.010000 ( 2.003406) slim 1.970000 0.030000 2.000000 ( 2.004234)
mustache 0.020000 0.010000 0.030000 ( 0.034893) mustache 0.030000 0.020000 0.050000 ( 0.047097)
liquid 0.050000 0.020000 0.070000 ( 0.074104) liquid 0.060000 0.010000 0.070000 ( 0.072771)
markaby 0.030000 0.020000 0.050000 ( 0.039915) markaby 0.020000 0.020000 0.040000 ( 0.037510)
builder 0.020000 0.010000 0.030000 ( 0.039993) builder 0.020000 0.020000 0.040000 ( 0.039034)
############################################################ ############################################################
## Render (small) (1000 runs) ## ## Render (small template) - 10.000 runs ##
############################################################ ############################################################
user system total real user system total real
string 0.010000 0.000000 0.010000 ( 0.009001) string 0.080000 0.000000 0.080000 ( 0.085994)
erubis 0.010000 0.000000 0.010000 ( 0.008587) erubis 0.090000 0.000000 0.090000 ( 0.094257)
erb 0.010000 0.000000 0.010000 ( 0.012027) erb 0.140000 0.010000 0.150000 ( 0.139963)
haml 0.020000 0.010000 0.030000 ( 0.022236) haml 0.220000 0.000000 0.220000 ( 0.221741)
slim 0.020000 0.000000 0.020000 ( 0.021628) slim 0.220000 0.000000 0.220000 ( 0.218883)
mustache 0.250000 0.000000 0.250000 ( 0.257850) mustache 2.480000 0.030000 2.510000 ( 2.515265)
liquid 0.050000 0.000000 0.050000 ( 0.045442) liquid 0.410000 0.010000 0.420000 ( 0.414001)
markaby 0.230000 0.000000 0.230000 ( 0.232095) markaby 2.390000 0.010000 2.400000 ( 2.401374)
builder 0.200000 0.000000 0.200000 ( 0.196965) builder 1.900000 0.010000 1.910000 ( 1.904287)
############################################################ ############################################################
## Compilation (big) (1000 runs) ## ## Compilation (big template) - 1.000 runs ##
############################################################ ############################################################
user system total real user system total real
string 0.030000 0.020000 0.050000 ( 0.043935) string 0.030000 0.010000 0.040000 ( 0.043037)
erubis 0.150000 0.020000 0.170000 ( 0.176325) erubis 0.130000 0.020000 0.150000 ( 0.156926)
erb 0.310000 0.020000 0.330000 ( 0.325486) erb 0.320000 0.020000 0.340000 ( 0.339588)
haml 1.190000 0.030000 1.220000 ( 1.217889) haml 1.210000 0.030000 1.240000 ( 1.231755)
slim 2.430000 0.030000 2.460000 ( 2.468188) slim 2.460000 0.030000 2.490000 ( 2.491272)
mustache 0.020000 0.020000 0.040000 ( 0.031460) mustache 0.030000 0.010000 0.040000 ( 0.047284)
liquid 0.110000 0.020000 0.130000 ( 0.134760) liquid 0.110000 0.020000 0.130000 ( 0.124385)
markaby 0.030000 0.010000 0.040000 ( 0.039455) markaby 0.020000 0.020000 0.040000 ( 0.037225)
builder 0.020000 0.020000 0.040000 ( 0.040826) builder 0.020000 0.010000 0.030000 ( 0.038738)
############################################################ ############################################################
## Render (big) (100 runs) ## ## Render (big template, 150KB data) - 30 runs ##
############################################################ ############################################################
user system total real user system total real
string 0.370000 0.020000 0.390000 ( 0.392442) string 0.150000 0.010000 0.160000 ( 0.155014)
erubis 0.450000 0.020000 0.470000 ( 0.463274) erubis 0.130000 0.010000 0.140000 ( 0.135254)
erb 0.630000 0.020000 0.650000 ( 0.651563) erb 0.200000 0.000000 0.200000 ( 0.205322)
haml 0.970000 0.010000 0.980000 ( 0.982174) haml 0.300000 0.010000 0.310000 ( 0.310301)
slim 1.410000 0.010000 1.420000 ( 1.422800) slim 0.420000 0.000000 0.420000 ( 0.423397)
mustache 3.760000 0.000000 3.760000 ( 3.757236) mustache 1.140000 0.000000 1.140000 ( 1.137800)
liquid 10.440000 0.040000 10.480000 ( 10.480874) liquid 3.210000 0.010000 3.220000 ( 3.221065)
markaby 11.560000 0.020000 11.580000 ( 11.576669) markaby 3.550000 0.020000 3.570000 ( 3.560586)
builder 18.300000 0.030000 18.330000 ( 18.326396) builder 5.620000 0.010000 5.630000 ( 5.637401)
``` ```

View File

@ -107,15 +107,15 @@ ENGINES = {
}, },
} }
banner 'Compilation (small) (%d runs)' % COMPILE_LOOPS banner 'Compilation (small template) - 1.000 runs'
benchmark(loops: COMPILE_LOOPS) do |name, attrs| benchmark(loops: 1000) do |name, attrs|
template_path = File.expand_path('../templates/%s/small.%s', __FILE__) % [name, attrs[:extension]] template_path = File.expand_path('../templates/%s/small.%s', __FILE__) % [name, attrs[:extension]]
templates[name] = attrs[:class].new(template_path) templates[name] = attrs[:class].new(template_path)
end end
puts puts
banner 'Render (small) (%d runs)' % RENDER_LOOPS banner 'Render (small template) - 10.000 runs'
benchmark(loops: RENDER_LOOPS) do |name, attrs| benchmark(loops: 10_000) do |name, attrs|
case name case name
when :slim when :slim
templates[name].render(OpenStruct.new(small_data)) templates[name].render(OpenStruct.new(small_data))
@ -125,15 +125,15 @@ benchmark(loops: RENDER_LOOPS) do |name, attrs|
end end
puts puts
banner 'Compilation (big) (%d runs)' % COMPILE_LOOPS banner 'Compilation (big template) - 1.000 runs'
benchmark(loops: COMPILE_LOOPS) do |name, attrs| benchmark(loops: 1000) do |name, attrs|
template_path = File.expand_path('../templates/%s/big.%s', __FILE__) % [name, attrs[:extension]] template_path = File.expand_path('../templates/%s/big.%s', __FILE__) % [name, attrs[:extension]]
templates[name] = attrs[:class].new(template_path) templates[name] = attrs[:class].new(template_path)
end end
puts puts
banner 'Render (big) (%d runs)' % 100 banner 'Render (big template, 1.5MB data) - 30 runs'
benchmark(loops: 100) do |name, attrs| benchmark(loops: 30) do |name, attrs|
case name case name
when :slim when :slim
templates[name].render(OpenStruct.new(customers: big_data)) templates[name].render(OpenStruct.new(customers: big_data))