comp.lang.ada
 help / color / mirror / Atom feed
From: "björn lundin" <b.f.lundin@gmail.com>
Subject: Re: Table of pointers question
Date: Fri, 25 Sep 2009 09:52:12 -0700 (PDT)
Date: 2009-09-25T09:52:12-07:00	[thread overview]
Message-ID: <e1061988-2243-40e0-a1c5-64f297131fad@e18g2000vbe.googlegroups.com> (raw)
In-Reply-To: e305ee6e-cf9e-4672-ac5d-4f528ce37c06@h14g2000pri.googlegroups.com

On 24 Sep, 03:34, Adam Beneschan <a...@irvine.com> wrote:
> The advantages of using an array of pointers is
> that a pointer is smaller than a DirectoryEntryType (and in a real-
> life application, it could be MUCH smaller), so if NumberOfEntries is,
> say, 15, allocating a fixed-size array of 1000 pointers and waiting
> until runtime to allocate 15 DirectoryEntryTypes takes a lot less
> memory than allocating 1000 DirectoryEntryTypes.
.....
> Also, when you do the
> exchange, you're moving two pointers around rather than moving two
> DirectoryEntryTypes, which is a lot faster since the pointers are
> smaller.

Is this true? Should one not expect the compiler to figure that out,
so what is shuffled
around, and memory allocated for, is for pointers, and not their
content?

Or do I have too much faith in compilers

/Björn
Björn Lundin



  parent reply	other threads:[~2009-09-25 16:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-24  0:47 Table of pointers question Rob Solomon
2009-09-24  1:34 ` Adam Beneschan
2009-09-24  6:39   ` tmoran
2009-09-25 16:52   ` björn lundin [this message]
2009-09-25 17:12     ` Adam Beneschan
2009-09-24  2:00 ` (see below)
2009-09-24  3:46 ` Jeffrey R. Carter
2009-09-24  6:59 ` Georg Bauhaus
2009-09-24  7:06   ` Georg Bauhaus
2009-09-24 14:55   ` Adam Beneschan
2009-09-26 13:45     ` Rob Solomon
2009-09-24  6:59 ` Stephen Leake
2009-09-26 13:50   ` Rob Solomon
     [not found] ` <3cadnZif2YjGbyfXnZ2dnUVZ_tmdnZ2d@earthlink.com>
2009-09-24 12:49   ` Robert A Duff
2009-09-26 13:36   ` Rob Solomon
2009-09-26 14:51     ` John B. Matthews
     [not found]     ` <3YSdnY7SXPNd_yPXnZ2dnUVZ_sydnZ2d@earthlink.com>
2009-09-26 18:58       ` Rob Solomon
2009-09-26 21:00       ` Georg Bauhaus
2009-09-27  5:53     ` Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox