comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Finding out minimal allocation unit
Date: Tue, 3 Apr 2007 18:45:59 +0200
Date: 2007-04-03T18:45:33+02:00	[thread overview]
Message-ID: <1ro1hy9egg3wk.4vh8fmzc8a5w$.dlg@40tude.net> (raw)
In-Reply-To: 20070403144350.6c95e085@cube.tz.axivion.com

On Tue, 3 Apr 2007 14:43:50 +0200, Stefan Bellon wrote:

> In a few places we are using long lists of items. Those items mostly
> consist of just a pointer or a record of two pointers. We need cheap
> insertions and deletions of elements in those lists, therefore we
> indeed used linked lists and no array solution.

If size is an issue, you can also use indices instead of access types.
Provided that all items have same size. Then you split your list of records
into lists of fields.

type Index is mod ...;

type Item_List is array (Index) of Item;
pragma Pack (Item_List);

type Previous is array (Index) of Index; 
pragma Pack (Previous);

type Next is array (Index) of Index; 
pragma Pack (Next);

First_Free  : Index := ...;
   -- The list of free items (empty)
First_In : Index := ...;
   -- The list (empty)
Non_Yet_Visited : Index := ...;
   -- To avoid initialization of the list of free items

You can avoid memory allocation in advance if you segment the arrays above
and split Index into (Segment_No, In_Segment) pair.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



      parent reply	other threads:[~2007-04-03 16:45 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-03 12:43 Finding out minimal allocation unit Stefan Bellon
2007-04-03 13:22 ` Georg Bauhaus
2007-04-03 13:28   ` Stefan Bellon
2007-04-03 13:34   ` Martin Krischik
2007-04-03 13:37     ` Stefan Bellon
2007-04-03 15:17       ` Markus E Leypold
2007-04-04 17:16         ` Robert A Duff
2007-04-05  8:55           ` Markus E Leypold
2007-04-05 17:55             ` Stefan Bellon
2007-04-06  1:40               ` Randy Brukardt
2007-04-06  8:06                 ` Stefan Bellon
2007-04-06 11:06                   ` Markus E Leypold
2007-04-03 23:53     ` Randy Brukardt
2007-04-05  6:12       ` Stefan Bellon
2007-04-05  7:35         ` Martin Krischik
2007-04-05 17:58           ` Stefan Bellon
2007-04-07  9:27             ` Martin Krischik
2007-04-10 21:42             ` Robert A Duff
2007-04-05 13:07         ` Robert A Duff
2007-04-05 18:02           ` Stefan Bellon
2007-04-06  1:31             ` Randy Brukardt
2007-04-06  8:10               ` Stefan Bellon
2007-04-06 17:17                 ` Simon Wright
2007-04-06 12:38         ` Stephen Leake
2007-04-03 14:12   ` Larry Kilgallen
2007-04-03 13:48 ` Robert A Duff
2007-04-03 16:45 ` Dmitry A. Kazakov [this message]
replies disabled

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