On 03/19/2012 01:33 PM, Derek wrote:
On Fri, 16 Mar 2012 13:16:18 +1100, Kevin <[email protected]> wrote:

This is in no way D specific but say you have two constant strings.

const char[] a = "1234567890";
// and
const char[] b = "67890";

You could lay out the memory inside of one another. IE: if a.ptr = 1
then b.ptr = 6. I'm not sure if this has been done and I don't think
it would apply very often but it would be kinda cool.

I thought of this because I wanted to pre-generate hex-representations
of some numbers I realized I could use half the memory if I nested
them. (At least I think it would be half).

Is the effort to do this really an issue with today's vast amounts of
RAM (virtual and real) available? How much memory are you expecting to
'save'?


Using less memory means having less cache misses and therefore improved performance. Saving half the memory can make quite a difference.

Reply via email to