View mode: basic / threaded / horizontal-split · Log in · Help
March 12, 2012
Compressed class references?
A significant percentage of heap memory in a 64 bit JavaVM is used by references, that are 8 bytes long. To reduce this problem they have invented "compressed references" (useful only for 64 bit systems), that turn references to 32 bit again:

https://blogs.oracle.com/jrockit/entry/understanding_compressed_refer

ftp://public.dhe.ibm.com/software/webserver/appserv/was/WAS_V7_64-bit_performance.pdf

With them the total amount of heap memory decreases. They don't slow down the class usage significantly, and the memory reduction reduces the CPU cache pressure, increasing the performance a bit.

Will this idea be useful for 64 bit D/DMD too, for D GC-managed class references (not for raw pointers)?

Bye,
bearophile
March 12, 2012
Re: Compressed class references?
On 12-03-2012 01:41, bearophile wrote:
> A significant percentage of heap memory in a 64 bit JavaVM is used by references, that are 8 bytes long. To reduce this problem they have invented "compressed references" (useful only for 64 bit systems), that turn references to 32 bit again:
>
> https://blogs.oracle.com/jrockit/entry/understanding_compressed_refer
>
> ftp://public.dhe.ibm.com/software/webserver/appserv/was/WAS_V7_64-bit_performance.pdf
>
> With them the total amount of heap memory decreases. They don't slow down the class usage significantly, and the memory reduction reduces the CPU cache pressure, increasing the performance a bit.
>
> Will this idea be useful for 64 bit D/DMD too, for D GC-managed class references (not for raw pointers)?
>
> Bye,
> bearophile

This probably can't work for D.

The problem is that D allows casting references to pointers. As we all 
know, a pointer is a distinct type from a reference, and casting a 
pointer to e.g. an integer type is perfectly valid and sometimes 
necessary. So, that is to say, this would blow up when doing the 
reference -> pointer conversion.

You could do it such that when one does the ref -> ptr conversion, the 
reference is simply expanded to a normal pointer, and vice versa. 
However, I'm not sure if this will hold water in the long run.

-- 
- Alex
March 12, 2012
Re: Compressed class references?
Le 12/03/2012 01:44, Alex Rønne Petersen a écrit :
> On 12-03-2012 01:41, bearophile wrote:
>> A significant percentage of heap memory in a 64 bit JavaVM is used by
>> references, that are 8 bytes long. To reduce this problem they have
>> invented "compressed references" (useful only for 64 bit systems),
>> that turn references to 32 bit again:
>>
>> https://blogs.oracle.com/jrockit/entry/understanding_compressed_refer
>>
>> ftp://public.dhe.ibm.com/software/webserver/appserv/was/WAS_V7_64-bit_performance.pdf
>>
>>
>> With them the total amount of heap memory decreases. They don't slow
>> down the class usage significantly, and the memory reduction reduces
>> the CPU cache pressure, increasing the performance a bit.
>>
>> Will this idea be useful for 64 bit D/DMD too, for D GC-managed class
>> references (not for raw pointers)?
>>
>> Bye,
>> bearophile
>
> This probably can't work for D.
>
> The problem is that D allows casting references to pointers. As we all
> know, a pointer is a distinct type from a reference, and casting a
> pointer to e.g. an integer type is perfectly valid and sometimes
> necessary. So, that is to say, this would blow up when doing the
> reference -> pointer conversion.
>
> You could do it such that when one does the ref -> ptr conversion, the
> reference is simply expanded to a normal pointer, and vice versa.
> However, I'm not sure if this will hold water in the long run.
>

Additionally, 64bits pointer is good for us : 
http://www.deadalnix.me/2012/03/05/impact-of-64bits-vs-32bits-when-using-non-precise-gc/ 
(shameless autopromotion inside).
Top | Discussion index | About this forum | D home