Try the following experiment.Copy Object>>shallowCopy to Object>>monitorShallowCopyand after the pragma add...Smalltalk at: #Monitor put: #Failed.Then in Playground...lastfail := 0.1 to: 100000 do: [ :n ||src copy|src := Array new: n.Smalltalk at: #Monitor put: #Succeeded.copy := src monitorShallowCopy.(Smalltalk at: #Monitor) == #Failed ifTrue: [Transcript crShow: n; tab; show: n - lastfail.lastfail := n.].].Produces the following interesting result....RUN1...65559 6555967670 211167685 1567700 1567715 1567730 15...69860 1569875 1569890 1569905 1572334 242972348 1472362 1472376 1472390 14...74854 1474868 1474882 1474896 1477681 278577694 1377707 1377720 1377733 13...80619 1380632 1380645 1380658 1383894 323683906 1283918 1283930 1283942 12...87338 1287350 1287362 1287374 1291189 381591200 1191211 1191222 1191233 11...95292 1195303 1195314 1195325 1199867 454299877 1099887 1099897 1099907 1099917 1099927 1099937 1099947 1099957 1099967 1099977 1099987 1099997 10RUN2...67660 6766067675 1567690 1567705 1567720 15....69865 1569880 1569895 1569910 1572324 241472338 1472352 1472366 1472380 14....74858 1474872 1474886 1474900 1477685 278577698 1377711 1377724 1377737 13....80623 1380636 1380649 1380662 1383898 323683910 1283922 1283934 1283946 12...87342 1287354 1287366 1287378 1291193 381591204 1191215 1191226 1191237 11...95285 1195296 1195307 1195318 1199871 455399881 1099891 1099901 1099911 1099921 1099931 1099941 1099951 1099961 1099971 1099981 1099991 10This is with* 60375-64.zip* cog_win64x64_squeak.stack.spur_201702021058.zip * Windows 7 Professional SP1cheers -benOn Tue, Feb 7, 2017 at 10:15 AM, Ciprian Teodorov <ciprian.teodorov@gmail.com> wrote:
>
>
> Thanks Ben,
>
> the <primitive: 148> seems to fail something like 4-5 % with my bench (osx 10.11.6, the latest Pharo/Cog)
>
> # of copy calls Failing primitive 148 Failing rate
> 1710 77 4,50%
> 3049 133 4,36%
> 51562 2947 5,72%
>
> and it does not seem to fail at all with something like:
>
> 1 to: 1000 do: [:i |
> (1 to: 100000) asArray copy.
> ]
>
> cheers
>
> On Tue, Feb 7, 2017 at 12:42 AM, Ben Coman <btc@openinworld.com> wrote:
>>
>>
>>
>>
>> On Tue, Feb 7, 2017 at 3:05 AM, Ciprian Teodorov <ciprian.teodorov@gmail.com> wrote:
>>>
>>>
>>> It is strange, to me it seems like the <primitive: 148> fails back to the smalltalk implementation (http://bit.ly/2kjYdHv).
>>> However when trying to copy a small array like #(1 2 3 4) copy I cannot step-into the #shallowCopy
>>> nor when I try to copy a big array like (1 to: 100000) asArray copy
>>>
>>> However, when I do cmd+. while running my bench the debugger stops in the shallowCopy
>>>
>>> is this a debugger thing ?
>>
>>
>> To check, can you add a transcript output next line after the primitive pragma?
>> cheers -ben
>>
>>
>>>
>>> or the primitive really fails ? -- which can explain the > 2.6 slowdown
>>>
>>> best regards,
>>> cip
>>>
>>> On Mon, Feb 6, 2017 at 7:36 PM, Ciprian Teodorov <ciprian.teodorov@gmail.com> wrote:
>>>>
>>>> Thanks guys I'll will try with the latest version and I'll come back with updates.
>>>>
>>>>
>>>> On Sun, Feb 5, 2017 at 8:25 PM, tim Rowledge <tim@rowledge.org> wrote:
>>>>>
>>>>>
>>>>>
>>>>> > On 05-02-2017, at 5:08 AM, Clément Bera <bera.clement@gmail.com> wrote:
>>>>> >
>>>>> > I remember there was a discussion about that somewhere but I can't find it. I cc vm-dev they may have a clue.
>>>>> >
>>>>> > When copying a pointer object in 64 bits instead of 32 bits, you need to copy twice many data, so it is going to be slower in any case.
>>>>>
>>>>> Err, not really. Probably. Assuming you have a 64 bit cpu etc, of course. And dependent on details of the memory architecture outside the cpu too - after all many systems do not need the memory chip organisation to match the cpu word size, having multiple lanes, burst read cache loading, even heterogenous regions (I suspect mostly in embedded systems for that, but y’never know).
>>>>>
>>>>> Yes, you’re moving twice as much stuff but it will still be a single read & write per word. After that you’re at the mercy of cache lines, write buffers, chip specs and not to mention the Hamsters.
>>>>>
>>>>> tim
>>>>> --
>>>>> tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim
>>>>> We can rescue a hostage or bankrupt a system. Now, what would you like us to do?
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Dr. Ciprian TEODOROV
>>>> Enseignant-chercheur
>>>> ENSTA Bretagne
>>>>
>>>> tél : 06 08 54 73 48
>>>> mail : ciprian.teodorov@gmail.com
>>>> www.teodorov.ro
>>>
>>>
>>>
>>>
>>> --
>>> Dr. Ciprian TEODOROV
>>> Enseignant-chercheur
>>> ENSTA Bretagne
>>>
>>> tél : 06 08 54 73 48
>>> mail : ciprian.teodorov@gmail.com
>>> www.teodorov.ro
>>>
>>
>>
>
>
>
> --
> Dr. Ciprian TEODOROV
> Enseignant-chercheur
> ENSTA Bretagne
>
> tél : 06 08 54 73 48
> mail : ciprian.teodorov@gmail.com
> www.teodorov.ro
>