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

View File

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