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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ead02e7101c0c023 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-02-28 16:28:44 PST Path: supernews.google.com!sn-xit-02!supernews.com!bignews.mediaways.net!newsfeeds.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!t-online.de!grolier!btnet-peer0!btnet!news5-gui.server.ntli.net!ntli.net!news11-gui.server.ntli.net.POSTED!not-for-mail Message-ID: <3A9E05B0.46B406ED@linuxchip.demon.co.uk> From: Dr Adrian Wrigley X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.2.14-5.0smp i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Problems with large records (GNAT) [continued] References: <3A9CD67C.9B15C417@linuxchip.demon.co.uk> <86lmqq8xks.fsf@acm.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Thu, 01 Mar 2001 00:17:52 -0800 NNTP-Posting-Host: 62.253.132.124 X-Complaints-To: abuse@ntlworld.com X-Trace: news11-gui.server.ntli.net 983405822 62.253.132.124 (Thu, 01 Mar 2001 00:17:02 GMT) NNTP-Posting-Date: Thu, 01 Mar 2001 00:17:02 GMT Organization: ntl Cablemodem News Service Xref: supernews.google.com comp.lang.ada:5341 Date: 2001-03-01T00:17:52-08:00 List-Id: Laurent Guerby wrote: > > Dr Adrian Wrigley writes: > > type Big_T is array (1 .. Size) of Float; > > > > type Item_T is record > > First : Float; > > Item : Big_T; > > Last : Float; > > end record; > > Why do you want to use a record here? Looks like 100% array here. This example shows the problem. Even if I use an simple array, I still can't calculate the size using the 'Size attribute, since that always raises an exception with the size of array used in some computations. With a record, I can add whatever fields I need later, without recoding stuff that already works. > Also, if you use a clean abstraction to your data structure (private > type), you can do all sorts of hacks behind the scene. Actually, I tried to use a generic package which could map data onto a file, hiding the implementation details. What I want is really a persistent object store, allowing different utilities to access the same data. It could be done with a standard database binding (eg using SQL), but the performance is much better with mmapped records, provided the 256M limit isn't broken. I tried using different "hacks" to get it to work with big records until I found this fundamental problem always caused the code to break. I have found no way to work out the size of the record reliably. > If you could describe more precisely the data structure you're trying > to mmap, perhaps comp.lang.ada readers could help a bit more. Since you ask, I have something like the following... ------------------------------------ type PriceSummary_T is record OpenPrice : Float; HighPrice : Float; LowPrice : Float; ClosePrice : Float; -- Split and dividend corrected price UncorrectedClose : Float; -- Raw share price Volume : Integer; Time : Time_T; end record; type StockIndex_T is new Integer range 1 .. 3000; type TradingDay_T is new Integer range 0 .. 1860; type DailyArray_T is array (TradingDay_T, StockIndex_T) of PriceSummary_T; type BooleanDailyArray_T is array (TradingDay_T, StockIndex_T) of Boolean; pragma Pack (BooleanDailyArray_T); type Oracle_T is record -- Various other record values may go here! Tradeable : BooleanDailyArray_T; Daily : DailyArray_T; end record; ------------------------------------ I then want to store Oracle_T representing 3000 stocks over seven years in a single file for efficient access by various utility programs. If I increase the number of stocks to 5000, things break and significant changes are necessary because the 256M limit is exceeded. Sometimes, the wrong answers are produced, which is particularly worrying. -- Dr Adrian Wrigley