2012/7/2 Dan Connelly <lists / ruby-forum.com>:
> Here's my contribution:
>
> Ruby:
> i = 0
> 10_000_000.times { i += 1 }
> puts i
>
> Perl:
> for my $n ( 0 .. 1e7 - 1) {
>   $i ++
> }
> print "$i\n"
>
> Result:
> Ruby: 2.970 seconds
> Perl: 0.682 seconds
>
> Wow...

The problem is that with every iteration inside #times, Ruby yield the
current "index" to the block - even if the block doesn't use this
variable at all.

And calling the block is no small operation... start here[1] (this is
the #times method, as defined in C) and see how deep the rabbit hole
goes.

[1] http://rxr.whitequark.org/mri/source/numeric.c#3441

-- Matma Rex