<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le sam. 27 avr. 2019 à 20:26, tim Rowledge <<a href="mailto:tim@rowledge.org">tim@rowledge.org</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On 2019-04-27, at 1:43 AM, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>> wrote:<br>
> <br>
> <br>
> <br>
> <br>
> Just ask, it's in the inbox now :)<br>
<br>
Good grief. That's some interesting code.<br>
<br>
BUT - it isn't in the inbox so far as I can see; the newest Kernel mcz is <a href="http://source.squeak.org/inbox/Kernel-nice.1216.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/inbox/Kernel-nice.1216.mcz</a> ... oh, wait, I see you've put an even newer version in trunk. Phew, I thought you might have been suffering from uploading problems like my NuScratch stuff.<br>
<br>
I merged (because I had my fastfib method already) your Kernel-nice.1220 and tried out [4784969 fastDoublingFib asString ] timeToRun . It crashed because of no Interval>>digitShiftSum: method, which needs to go into Collections I guess.<br>
<br></blockquote><div>Oups! It's in Collection, I forgot to commit it!</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Previously<br>
[4784969 fastDoublingFib asString ] timeToRun -> 136833mS (on my Pi3+)<br>
Now <br>
[4784969 fastDoublingFib asString ] timeToRun  -> 21060mS<br>
Call 6.5X faster.  <br><br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Assuming we are all confident about the correctness I'd urge making that the default multiply for large ints. Unless somebody is going to improve the plugin to assist in making this even faster?<br>
<br>
tim<br></blockquote><div><br></div><div>The problem is that fastMultiply: just put overhead for every moderately LargeIntegers, which is the most common case, so I hesitate to do it the default.</div><div><br></div><div>Implementing divide and conquer in the primitives is also not a pleasant path: divide and conquer often trade speed for space, so it means that we must massively allocate new objects in primitives which is a difficult task. Or resuse some preallocated memory, which gives a horrible taste to these beautiful and simple algorithms. Also it hides those algorithms from our view, make debugging not a pleasure, and make improvment a less enjoyable hobby.</div><div><br></div><div>What we could do instead, is to make some primitive fail when digitLength is above a certain threshold.</div><div>That threshold would be a parameter controlled from the image, and a default value of 0 at VM startup could mean no primitive failure making the VM friendly to those image not Karatsuba aware...<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
--<br>
tim Rowledge; <a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>; <a href="http://www.rowledge.org/tim" rel="noreferrer" target="_blank">http://www.rowledge.org/tim</a><br>
Useful random insult:- Talks to plants on their own level.<br>
<br>
<br>
<br>
</blockquote></div></div>