## Managed Open Source blog code
# http://blog.managedopensource.com
# http://blog.managedopensource.com/2007/10/31/reversal-of-code-performance-optimizations-from-ruby-1-8-to-1-9

## R analysis code for benchmark results
> for_real_totals <- c(5.962244, 5.916540, 5.986721, 5.900563)
> each_real_totals <- c(6.158466, 6.165264, 6.135532, 6.131811)
> list_real_totals <- c(6.855109, 6.918924, 6.871511, 6.912522)
> collect_real_totals <- c(6.423387, 6.398015, 6.392726, 6.407939)

On to ratios...
> c1_to_c2_ratio <- for_real_totals / each_real_totals
> c1_to_c2_ratio
[1] 0.9681378 0.9596572 0.9757460 0.9622872

> c3_to_c4_ratio <- list_real_totals / collect_real_totals
> c3_to_c4_ratio
[1] 1.067211 1.081417 1.074895 1.078743

Since c4 (aka "collect") is faster take the inverse ratio...
> c4_to_c3_ratio <- collect_real_totals / list_real_totals
> c4_to_c3_ratio
[1] 0.9370219 0.9247124 0.9303232 0.9270045

On to standard deviations....
> stdev.for <- sd(for_real_totals)
> stdev.for
[1] 0.0398919

> stdev.each <- sd(each_real_totals)
> stdev.each
[1] 0.01658215

> stdev.list <- sd(list_real_totals)
> stdev.list
[1] 0.03110267

> stdev.collect <- sd(collect_real_totals)
> stdev.collect
[1] 0.01347952

> avg.for <- mean(for_real_totals)
> avg.for
[1] 5.941517

> avg.each <- mean(each_real_totals)
> avg.each
[1] 6.147768

> avg.list <- mean(list_real_totals)
> avg.list
[1] 6.889517

> avg.collect <- mean(collect_real_totals)
> avg.collect
[1] 6.405517

> avg.c1_to_c2_ratio <- avg.for / avg.each
> avg.c1_to_c2_ratio
[1] 0.966451

> avg.c3_to_c4_ratio <- avg.list / avg.collect
> avg.c3_to_c4_ratio
[1] 1.075560

> avg.c4_to_c3_ratio <- avg.collect / avg.list
> avg.c4_to_c3_ratio
[1] 0.9297484