From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2caa964596702891 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!newsfeed-00.mathworks.com!newsfeed.cs.wisc.edu!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail Date: Thu, 10 Aug 2006 10:16:20 -0400 From: Matthew Heaney Organization: On2 Technologies, Inc User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada.Containers and Storage_Pools References: <1155125040.715167.132300@m73g2000cwd.googlegroups.com> <44DA09B7.6010607@on2.com> <1155193272.902814.41240@i42g2000cwa.googlegroups.com> In-Reply-To: <1155193272.902814.41240@i42g2000cwa.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <44db3fb0$0$1013$39cecf19@news.twtelecom.net> NNTP-Posting-Date: 10 Aug 2006 14:16:16 GMT NNTP-Posting-Host: 9c80970f.news.twtelecom.net X-Trace: DXC=lNTWmfd0Zc>I]9knNJ:Q55C_A=>8kQj6=Y;@_o827nG3VLJ:_1FmOG6TEK3kFaEVa3heZJ\05aQI: X-Complaints-To: abuse@twtelecom.net Xref: g2news2.google.com comp.lang.ada:6155 Date: 2006-08-10T14:16:16+00:00 List-Id: 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.