Results for VisualAge (just FYI):
| count |
count := 0.
[1 to: 10000000 do: [:i | count :=count + 1]] timeToRun.� "151702"
| count |
count := 0.
[10000000 timesRepeat: [count := count + 1]] timeToRun.�� "139971"
�
(results are in microseconds)
So maybe there's a case for inlining #timesRepeat: (or making a clear comment that it is much slower in Pharo)
Just my $0:02
--
Cheers,
Peter
Normal. to:do: is lnlined (compiled as jumps in the bytecode), whereas timesRepeat: is a message
On Nov 13, 2009, at 9:51 AM, C�drick B�ler wrote:
> Hi,
>
> I noticed quite a difference between the two method who "looks" the same to me. Is it normal ?
>
send with a closure activation.
� � � �Marcus
fun is the difference between:
� � � �(1 to : 10000) do:
and
� � � �1 to: 10000 do:
one is compiled to jumps, the other not and in addition creates a temp collection.
� � � �Marcus
> _______________________________________________
> I use a rc image (haven't tested in squeak). And it's the same on windows and linux.
>
> count := 0.
> [1 to: 10000000 do: [:i | count :=count + 1]] timeToRun." 677"
> count := 0.
> [10000000 timesRepeat: [count := count + 1]] timeToRun" 2571"
>
> If not normal, I'll open a issue.
>
> Thanks
>
> --
> C�drick
> Pharo-project mailing list
> Pharo-project@lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project