[Vm-dev] Integer comparition primitive failures on Cog

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Tue May 3 16:23:59 UTC 2011


Hem, some declaration were missing... and the argument for FP
comparison is tricky indeed...
Sorry for the noise, but this is a direct live

Nicolas

2011/5/3 Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:
> And if  genSmallIntegerComparison:orDoubleComparison: is correct, then
> usage shall be quite straight forward
>
> Nicolas
>
> 2011/5/3 Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:
>> I always refused to learn x86 assembler, but by code imitation I can
>> give my own try in attachment.
>> Note that I did not use the trick to invert FP comparison operands
>> since this does not seem necessary.
>>
>> Nicolas
>>
>>
>> 2011/5/2 Eliot Miranda <eliot.miranda at gmail.com>:
>>>
>>> Hi Henrik,
>>>
>>> Eliot (phone)
>>>
>>> On May 2, 2011, at 3:12 AM, Henrik Sperre Johansen <henrik.s.johansen at veloxit.no> wrote:
>>>
>>>> As per my comment on the recent Morphic performance graphs,(http://blog.openinworld.com/2011/03/morphic-flavour-performance/#comment-59) on a Cog VM these primitives fail with a Float parameter, which leads to a huge performance hit when comparing Ints to Floats by doing silly things in the fallback code.
>>>>
>>>> Cog:
>>>> [1 to: 2000000 do: [:i |
>>>>    i < 2354.234.
>>>>    i <= 2354.234.
>>>>    i >= 2354.234.
>>>>     i > 2354.234.]] timeToRun 26594
>>>>
>>>> Trunk:
>>>> [1 to: 2000000 do: [:i |
>>>>    i < 2354.234.
>>>>    i <= 2354.234.
>>>>    i >= 2354.234.
>>>>     i > 2354.234.]] timeToRun 229
>>>>
>>>> Should this be changed in the VM,
>>>
>>> I think so.  When I first wrote the SmallInteger translated prims I hadn't yet written the JIT support for floats and so couldn't write int/float comparison.  Now all the support is there and it should be straight-forward.  Do you fancy trying to write this yourself?  Would be a fun exercise.  Let me know and I can hand-hold with using the simulator.
>>>
>>>
>>> Best
>>> Eliot (phone)
>>>
>>>
>>>> or is the difference for pure int/int comparition large enough that we should instead change
>>>> Float>>adaptToInteger: andCompare:
>>>> to use the corresponding comparitions with Float as receiver, which does work?
>>>> That's still slower than trunk in my image, but quite a bit better, above test takes about 1s.
>>>>
>>>> Cheers,
>>>> Henry
>>>
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cogitCompareSmallIntegerAndFloat.st
Type: application/octet-stream
Size: 4951 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20110503/09456d1e/cogitCompareSmallIntegerAndFloat.obj


More information about the Vm-dev mailing list