Jump to page: 1 26  
Page
Thread overview
What would be the consequence of implementing interfaces as fat pointers ?
Mar 30, 2014
deadalnix
Mar 30, 2014
Walter Bright
Mar 30, 2014
deadalnix
Mar 30, 2014
Walter Bright
Mar 30, 2014
deadalnix
Mar 30, 2014
Walter Bright
Mar 31, 2014
Manu
Apr 01, 2014
dajones
Apr 01, 2014
Manu
Apr 01, 2014
dajones
Apr 02, 2014
deadalnix
Apr 02, 2014
deadalnix
Apr 02, 2014
deadalnix
Mar 31, 2014
Manu
Mar 31, 2014
bearophile
Mar 31, 2014
Manu
Mar 31, 2014
Walter Bright
Mar 31, 2014
Manu
Mar 31, 2014
w0rp
Mar 31, 2014
Walter Bright
Apr 01, 2014
Manu
Apr 01, 2014
Michel Fortin
Apr 01, 2014
Manu
Mar 31, 2014
Walter Bright
Mar 31, 2014
Manu
Mar 31, 2014
Adam D. Ruppe
Mar 31, 2014
Manu
Mar 31, 2014
John Colvin
Mar 31, 2014
Walter Bright
Mar 31, 2014
Manu
Mar 31, 2014
Walter Bright
Apr 01, 2014
Manu
Apr 01, 2014
Walter Bright
Apr 01, 2014
Manu
Apr 01, 2014
Michel Fortin
Apr 01, 2014
Daniel Murphy
Apr 01, 2014
Manu
Apr 01, 2014
Michel Fortin
Apr 01, 2014
Dicebot
Apr 01, 2014
Paolo Invernizzi
Apr 01, 2014
Walter Bright
Mar 31, 2014
Artur Skawina
Mar 31, 2014
Walter Bright
Mar 31, 2014
Artur Skawina
Mar 31, 2014
Adam D. Ruppe
Mar 31, 2014
Artur Skawina
Mar 31, 2014
Chris
Mar 30, 2014
Daniel Murphy
Mar 30, 2014
Walter Bright
Mar 30, 2014
Daniel Murphy
Mar 30, 2014
Walter Bright
Mar 31, 2014
Orvid King
Mar 31, 2014
Daniel Murphy
Mar 30, 2014
Benjamin Thaut
Mar 31, 2014
QAston
March 30, 2014
All is in the title.

This is becoming increasingly the norm in new languages. It is much better in term of performances (it avoid cascaded loads to call methods, which can be really costly on modern CPUs), make object themselves smaller.

Would implementing them that way break D code ? What would be the extent of the breakage ?
March 30, 2014
On 3/29/2014 5:57 PM, deadalnix wrote:
> All is in the title.
>
> This is becoming increasingly the norm in new languages. It is much better in
> term of performances (it avoid cascaded loads to call methods, which can be
> really costly on modern CPUs), make object themselves smaller.
>
> Would implementing them that way break D code ? What would be the extent of the
> breakage ?

D already has phat pointers - that's what delegates are. I'm curious how the scheme you propose is different?
March 30, 2014
On Sunday, 30 March 2014 at 01:04:27 UTC, Walter Bright wrote:
> On 3/29/2014 5:57 PM, deadalnix wrote:
>> All is in the title.
>>
>> This is becoming increasingly the norm in new languages. It is much better in
>> term of performances (it avoid cascaded loads to call methods, which can be
>> really costly on modern CPUs), make object themselves smaller.
>>
>> Would implementing them that way break D code ? What would be the extent of the
>> breakage ?
>
> D already has phat pointers - that's what delegates are. I'm curious how the scheme you propose is different?

I'm talking about interface here. The way they are implemented in most new language is via a struct that contains:
 - pointer to the object
 - pointer to vtable

That way to don't make object bigger when they implement an interface, and you don't need cascaded load to call methods.
March 30, 2014
On 3/29/2014 6:11 PM, deadalnix wrote:
> I'm talking about interface here. The way they are implemented in most new
> language is via a struct that contains:
>   - pointer to the object
>   - pointer to vtable
>
> That way to don't make object bigger when they implement an interface,

True, but why is this a problem?

> and you don't need cascaded load to call methods.

True, but on the other hand, it takes up 2 registers rather than one, costing twice as much to copy around, store, pass/return to functions, etc.

March 30, 2014
On Sunday, 30 March 2014 at 01:42:24 UTC, Walter Bright wrote:
> On 3/29/2014 6:11 PM, deadalnix wrote:
>> I'm talking about interface here. The way they are implemented in most new
>> language is via a struct that contains:
>>  - pointer to the object
>>  - pointer to vtable
>>
>> That way to don't make object bigger when they implement an interface,
>
> True, but why is this a problem?
>

Higher memory consumption, less objects fitting in cache, more scanning to do for the GC.

>> and you don't need cascaded load to call methods.
>
> True, but on the other hand, it takes up 2 registers rather than one, costing twice as much to copy around, store, pass/return to functions, etc.

Two pointers structs are passed in register, which is fast. If that spill, that spill on stack, which is hot, and prefetcher friendly.

On the other hand, the double indirection is very cache unfriendly.
March 30, 2014
"deadalnix"  wrote in message news:jizqsnuigdsvxhtcsshl@forum.dlang.org...

> All is in the title.
>
> This is becoming increasingly the norm in new languages. It is much better in term of performances (it avoid cascaded loads to call methods, which can be really costly on modern CPUs), make object themselves smaller.
>
> Would implementing them that way break D code ? What would be the extent of the breakage ?

It could, but we don't have a stable ABI and we don't allow directly casting from interface references to classes.  I would be interested to see how the performance changes on some interface-heavy D code - and honestly without an implementation that shows a big speed bump I don't think this will ever happen. 

March 30, 2014
On 3/29/2014 8:26 PM, Daniel Murphy wrote:
> It could, but we don't have a stable ABI

? The ABI for interfaces hasn't changed in many years. In fact I don't even remember changes in it.

March 30, 2014
"Walter Bright"  wrote in message news:lh83dr$6m1$1@digitalmars.com...

> On 3/29/2014 8:26 PM, Daniel Murphy wrote:
> > It could, but we don't have a stable ABI
>
> ? The ABI for interfaces hasn't changed in many years. In fact I don't even remember changes in it.

I meant stable in the sense that we _can't_ break it, not that we _haven't_ broken it recently.

ie we don't guarantee binary compatibility across releases. 

March 30, 2014
On 3/29/2014 8:06 PM, deadalnix wrote:
> On Sunday, 30 March 2014 at 01:42:24 UTC, Walter Bright wrote:
>> True, but why is this a problem?
> Higher memory consumption, less objects fitting in cache, more scanning to do
> for the GC.

Debatable. All fields that are interface references would double in size.


>>> and you don't need cascaded load to call methods.
>>
>> True, but on the other hand, it takes up 2 registers rather than one, costing
>> twice as much to copy around, store, pass/return to functions, etc.
>
> Two pointers structs are passed in register, which is fast. If that spill, that
> spill on stack, which is hot, and prefetcher friendly.

That underestimates how precious register real estate is on the x86.


> On the other hand, the double indirection is very cache unfriendly.

I suspect that the results of all this will be some use cases go faster, other use cases go slower, a decidedly mixed result.

March 30, 2014
On 3/29/2014 8:38 PM, Daniel Murphy wrote:
> "Walter Bright"  wrote in message news:lh83dr$6m1$1@digitalmars.com...
>
>> On 3/29/2014 8:26 PM, Daniel Murphy wrote:
>> > It could, but we don't have a stable ABI
>>
>> ? The ABI for interfaces hasn't changed in many years. In fact I don't even
>> remember changes in it.
>
> I meant stable in the sense that we _can't_ break it, not that we _haven't_
> broken it recently.
>
> ie we don't guarantee binary compatibility across releases.

ok.
« First   ‹ Prev
1 2 3 4 5 6