SmallIntPair as immediate word

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

SmallIntPair as immediate word

K K Subbu
 
All,

Squeak release image contains around 15k Points with none using more
than 24 bits per coordinate.

On 64-bit machines, it should be possible to pack two integers of a pair
into a single immediate word - 30+30.

Has anyone tried to do this? It would save space and eliminate object
alloc. But I am not sure about the overall performance hit.

Regards .. Subbu
Reply | Threaded
Open this post in threaded view
|

Re: SmallIntPair as immediate word

Tobias Pape
 
Hi Subbu,


> On 09.04.2019, at 18:44, K K Subbu <[hidden email]> wrote:
>
> All,
>
> Squeak release image contains around 15k Points with none using more than 24 bits per coordinate.
>
> On 64-bit machines, it should be possible to pack two integers of a pair into a single immediate word - 30+30.
>
> Has anyone tried to do this? It would save space and eliminate object alloc. But I am not sure about the overall performance hit.
>
> Regards .. Subbu

I'm _really_ interested how you arrived at those numbers. Can you share the code for your analysis?

Best regards
        -Tobias
Reply | Threaded
Open this post in threaded view
|

Re: SmallIntPair as immediate word

K K Subbu
 
On 10/04/19 12:44 AM, Tobias Pape wrote:

>
> Hi Subbu,
>
>
>> On 09.04.2019, at 18:44, K K Subbu <[hidden email]> wrote:
>>
>> All,
>>
>> Squeak release image contains around 15k Points with none using
>> more than 24 bits per coordinate.
>>
>> On 64-bit machines, it should be possible to pack two integers of a
>> pair into a single immediate word - 30+30.
>>
>> Has anyone tried to do this? It would save space and eliminate
>> object alloc. But I am not sure about the overall performance hit.
>>
>> Regards .. Subbu
>
> I'm _really_ interested how you arrived at those numbers. Can you
> share the code for your analysis?

Squeak 5.2 (Linux 64b) #18231

{Point. Fraction} collect: [:c | c allSubInstances size]
    #(12118 32)

Point allSubInstances select: [ :p | (p x >= (2 raisedTo: 24)) or: (p y
 >= (2 raisedTo: 24))]
        an OrderedCollection ()
Fraction allSubInstances select: [ :p | (p numerator >= (2 raisedTo:
24)) or: (p denominator >= (2 raisedTo: 24))]
        an OrderedCollection ()

Regards .. Subbu
Reply | Threaded
Open this post in threaded view
|

Re: SmallIntPair as immediate word

Stephan Eggermont-3
In reply to this post by Tobias Pape
 
Tobias Pape <[hidden email]> wrote:
>  
Hi Subbu,


> On 09.04.2019, at 18:44, K K Subbu <[hidden email]> wrote:
>
> All,
>
> Squeak release image contains around 15k Points with none using more than
> 24 bits per coordinate.
>
> On 64-bit machines, it should be possible to pack two integers of a pair
> into a single immediate word - 30+30.
>
> Has anyone tried to do this? It would save space and eliminate object
> alloc. But I am not sure about the overall performance hit.
>
> Regards .. Subbu

Does that hold when using 8K displays?

Stephan



Reply | Threaded
Open this post in threaded view
|

Re: SmallIntPair as immediate word

Eliot Miranda-2
In reply to this post by K K Subbu
 
Hi Subbu,

> On Apr 9, 2019, at 9:44 AM, K K Subbu <[hidden email]> wrote:
>
> All,
>
> Squeak release image contains around 15k Points with none using more than 24 bits per coordinate.
>
> On 64-bit machines, it should be possible to pack two integers of a pair into a single immediate word - 30+30.

Yes, but not without losing the single bit tag tests the 64-bit VM uses now.  So doing this would reduce slightly the efficiencies of SmallInteger, Character and SmallFloat64.  And performance for these classes is much more important than making point devise more complex, in the image and in graphics plugins.

>
> Has anyone tried to do this? It would save space and eliminate object alloc. But I am not sure about the overall performance hit.

I think these kinds of things don’t work well in practice.  And as Stephan points out we are two generations of display technology away from not being able to use such compact points to represent the entire display coordinate space.

At this stage it’s better to invest in more powerful and more general optimization strategies; ie Sista/Scorch.  With Clément leaving for google, hopefully only for a few years, I could do with competent help here.

>
> Regards .. Subbu
Reply | Threaded
Open this post in threaded view
|

Re: SmallIntPair as immediate word

K K Subbu
In reply to this post by Stephan Eggermont-3
 
On 10/04/19 4:03 PM, Stephan Eggermont wrote:

>
>> On 09.04.2019, at 18:44, K K Subbu<[hidden email]>  wrote:
>>
>> All,
>>
>> Squeak release image contains around 15k Points with none using more than
>> 24 bits per coordinate.
>>
>> On 64-bit machines, it should be possible to pack two integers of a pair
>> into a single immediate word - 30+30.
>>
>> Has anyone tried to do this? It would save space and eliminate object
>> alloc. But I am not sure about the overall performance hit.
>>
>> Regards .. Subbu
> Does that hold when using 8K displays?

Yes. 8K is 7680 x 4320 - 13bits each for x and y. That is just 13bits
for x and y. In any case, if any integer in a pair overflows, it will be
stored in a heap object.

Regards .. Subbu