[Cuis-dev] usefulness of a faster #timesRepeat?
Andres Valloud
ten at smallinteger.com
Fri Nov 8 20:18:54 PST 2019
Hi,
>> First, especially in 32 bit systems, it's very important never to send
>> timesRepeat: to a large integer --- this is why the large integer
>> method splits the process in rounds of timesRepeat: sent to small
>> integers.
>
> I guess you mean 'never run the iteration on LargeInteger arithmetic',
> so with the splitting in LargePositiveInteger, sending timesRepeat: to a
> large integer is ok...
Yeah, that's what I meant. If you only had the simple implementation in
Integer, then the to:do: will create large integers for every iteration.
That is a) slow in itself, and b) creates garbage that later has to be
collected.
> Interesting. Not the case in Cuis, where there is no Compiler
> optimization of #timesRepeat:
Right --- if that did happen though, then we'd be looking at writing
timesRepeat: [aBlock value].
> Still, I wasn't explicit on what I really wanted to ask... My question
> is: Is #bench (or bench: seconds) a good replacement for #timesRepeat:?
> If so, does still make sense to have an optimized version of #timesRepeat:?
If there was bench: seconds, and if that accepted a float argument so
one could say things like bench: 1.5 and things like that, then the
timesRepeat: improvement would be less important for this use case.
The timesRepeat: improvements might still matter, but we'd have to find
another justification for them first.
Andres.
More information about the Cuis-dev
mailing list