From: Dr Adrian Wrigley <amtw@linuxchip.demon.co.uk>
Subject: Re: Problems with large records (GNAT) [continued]
Date: Thu, 01 Mar 2001 00:17:52 -0800
Date: 2001-03-01T00:17:52-08:00 [thread overview]
Message-ID: <3A9E05B0.46B406ED@linuxchip.demon.co.uk> (raw)
In-Reply-To: 86lmqq8xks.fsf@acm.org
Laurent Guerby wrote:
>
> Dr Adrian Wrigley <amtw@linuxchip.demon.co.uk> 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
next prev parent reply other threads:[~2001-03-01 8:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-28 10:44 Problems with large records (GNAT) [continued] Dr Adrian Wrigley
2001-02-28 3:13 ` Robert A Duff
2001-02-28 12:09 ` Dr Adrian Wrigley
2001-02-28 9:51 ` Florian Weimer
2001-02-28 18:35 ` Laurent Guerby
2001-03-01 8:17 ` Dr Adrian Wrigley [this message]
2001-03-01 1:58 ` Robert A Duff
2001-03-01 22:18 ` Dr Adrian Wrigley
2001-03-01 17:02 ` Robert A Duff
2001-03-01 7:00 ` tmoran
2001-03-01 21:52 ` Dr Adrian Wrigley
2001-03-01 19:32 ` tmoran
2001-03-01 19:38 ` Laurent Guerby
2001-03-02 20:32 ` Randy Brukardt
2001-03-07 2:15 ` Dr Adrian Wrigley
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox