<div dir="ltr">Another 17%</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El vie., 11 oct. 2019 a las 0:16, Andres Valloud via Cuis-dev (<<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Another 10% or so. Looks like this is finally hitting diminishing returns.<br>
<br>
On 10/10/19 20:04, Andres Valloud via Cuis-dev wrote:<br>
> Do you see any way to improve upon it? If not... maybe it's time to <br>
> integrate the thing already.<br>
> <br>
> On 10/10/19 20:02, Agustín Sansone via Cuis-dev wrote:<br>
>> With this last improvement:<br>
>> Time millisecondsToRun:<br>
>> [10000 timesRepeat: [1 to: 1600 do: [:e | e isPrimeFast2]] ] <br>
>> 3502<br>
>><br>
>> Without it:<br>
>> Time millisecondsToRun:<br>
>> [10000 timesRepeat: [1 to: 1600 do: [:e | e isPrimeFast]] ] <br>
>> 4982<br>
>><br>
>> It is indeed a 30% speed increase for numbers up to 1521.<br>
>><br>
>> El jue., 10 oct. 2019 a las 23:35, Andres Valloud via Cuis-dev <br>
>> (<<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a> <mailto:<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>>>) escribió:<br>
>><br>
>> Hmmm, in here,<br>
>><br>
>> self < 384 ifTrue: [<br>
>> "Approximate sqrtFloor to avoid computational <br>
>> expense"<br>
>> 3 to: (self bitShift: -3) + 1 by: 2 do:<br>
>> [:each | self \\ each = 0 ifTrue: [ <br>
>> ^false ]].<br>
>> ^true<br>
>> ].<br>
>><br>
>><br>
>> the loop should start at 7 because the factors 3 and 5 have already<br>
>> been<br>
>> excluded. This gains noticeable speed for smallish integers (because<br>
>> 384 sqrtFloor is just 19). Looking into this further led to another<br>
>> 30%<br>
>> speed increase. Would you mind checking?<br>
>><br>
>> On 10/10/19 18:40, Agustín Sansone via Cuis-dev wrote:<br>
>> > Here's something really important: doing too much<br>
>> micro-optimization<br>
>> > detracts from the motivation to implement better things. I'd<br>
>> say we<br>
>> > leave things with the round of 30.<br>
>> ><br>
>> ><br>
>> > Okay. This is the 30*k version.<br>
>> ><br>
>> -- Cuis-dev mailing list<br>
>> <a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a> <mailto:<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a>><br>
>> <a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
>><br>
>><br>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div>