comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <mheaney@on2.com>
Subject: Re: Ada.Containers and Storage_Pools
Date: Thu, 10 Aug 2006 10:16:20 -0400
Date: 2006-08-10T14:16:16+00:00	[thread overview]
Message-ID: <44db3fb0$0$1013$39cecf19@news.twtelecom.net> (raw)
In-Reply-To: <1155193272.902814.41240@i42g2000cwa.googlegroups.com>

msimonides@power.com.pl wrote:
 >
> Having such a pool for use by containers' internal structures would
> enable us to choose more appropriate container types in terms of memory
> usage (eg. we had a list of data elements in resource records but now
> use vectors as they have less memory overhead on each element and are
> as good performance-wise when the number of nodes is small. But there
> is no (easy) way of measuring it).

If you had a single-linked list, would you have used that instead of the 
vector?


>> One possibility is to keep a list around and use it as a kind of storage
>> pool for the list objects that are map elements.  You can use the Splice
>> operation for lists to move list nodes between list objects (that are
>> map elements) and the list object that serves as the pool.
> 
> Yes, but this is only a partial solution. Adapting it to thousands of
> small vectors seems infeasible.

Here's another idea.  For the pool, you could use a container (say, a 
list or map) of vectors, with the vector elements of the container 
ordered by their capacity.  If you need a vector, you would search the 
container for a vector having the requisite capacity, and then use the 
Move operation to move its internal array onto your vector object. 
Would that work?



> Ideally I could just specify the maximal size for all cache structures
> together and have the storage pool enforce it.

The pool abstraction I describe above would only allow you to control 
the memory for the vectors, not the total memory for maps and their 
vector elements.  But it might be good enough if the storage for the 
elements stored in the vectors is large compared to the number of map 
elements.



  reply	other threads:[~2006-08-10 14:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-09 12:04 Ada.Containers and Storage_Pools msimonides
2006-08-09 13:27 ` Colin Paul Gloster
2006-08-09 16:16   ` Matthew Heaney
2006-08-09 16:05 ` Martin Krischik
2006-08-09 16:13 ` Matthew Heaney
2006-08-10  7:01   ` msimonides
2006-08-10 14:16     ` Matthew Heaney [this message]
2006-08-11 18:22       ` msimonides
replies disabled

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