comp.lang.ada
 help / color / mirror / Atom feed
From: "Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk>
Subject: Re: Efficiently setting up large quantities of constant data
Date: Thu, 16 Dec 2004 23:47:50 GMT
Date: 2004-12-16T23:47:50+00:00	[thread overview]
Message-ID: <pan.2004.12.16.23.47.43.397301@linuxchip.demon.co.uk.uk.uk> (raw)
In-Reply-To: 4LGruwf2lqzz@eisner.encompasserve.org

On Thu, 16 Dec 2004 15:52:28 -0600, Larry Kilgallen wrote:

> In article <cpsfjh$fg3$1@news4.zwoll1.ov.home.nl>, Andre <avsaway@hotmail.com> writes:
>> Dr. Adrian Wrigley wrote:
> 
>>> For example, suppose I have a binary file "distances.dat" containing
>>> the (road) distances between 1000 different cities.  This could be a 2MB
>>> file computed by another application. How can I build a single executable
>>> file containing the data and access it from the Ada code?
> 
>> 2. Use a memory mapped file. This way you also get a pointer to the data 
>> and Windows is taking care of loading it into the memory. Data reading 
>> using a memory mapped file is just as fast as putting it in the executable.
> 
> But since he did not say the purpose of putting it in the application
> was for speed, I think we have to presume it was for religious reasons.

It seems like a good idea in some circumstances:

Atomic upgrade - replace the binary in one step may be useful,
particularly in a real-time system (think cron job running single
executable avoids possible inconsistency of old data files during upgrade)

obscures internal structures a bit - makes it a bit harder for users to
mess around with/view internal structure (eg substituting their own data
files)

simpler distribution - can put executable in /usr/bin without messy
directory of data files to go somewhere.  No need for .tar.gz archive.
Also simpler to remove and to verify.

I like the objcopy route over generating and compiling Ada source
(particularly for large data), since it avoids potential compiler limits,
and doesn't risk unexpected efficiency problems (stack space/elaboration
time/code space, compilation time etc.).

but mostly it was religious, yes...
-- 
Adrian




  parent reply	other threads:[~2004-12-16 23:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-13 21:48 Efficiently setting up large quantities of constant data Michael Mounteney
2004-12-13 22:09 ` Stephen Leake
2004-12-13 22:15 ` Luke A. Guest
2004-12-14  0:20 ` Jeffrey Carter
2004-12-14  8:43 ` Martin Krischik
2004-12-14 12:18 ` Simon Wright
2004-12-15 21:10   ` Brian May
2004-12-16 23:18     ` Nick Roberts
2004-12-16 12:36 ` Dr. Adrian Wrigley
2004-12-16 13:50   ` Marc A. Criley
2004-12-17  2:32     ` John B. Matthews
2004-12-16 14:06   ` rien
2004-12-16 14:24   ` Vinzent 'Gadget' Hoefler
2004-12-16 18:12     ` Dr. Adrian Wrigley
2004-12-16 23:25       ` Nick Roberts
2004-12-17  5:20     ` tmoran
2004-12-17  8:38       ` Vinzent 'Gadget' Hoefler
2004-12-17 13:53     ` Dr. Adrian Wrigley
2004-12-17 14:16       ` Alex R. Mosteo
2004-12-16 17:11   ` Andre
2004-12-16 21:52     ` Larry Kilgallen
2004-12-16 23:23       ` Nick Roberts
2004-12-16 23:47       ` Dr. Adrian Wrigley [this message]
2004-12-19 14:34         ` Simon Wright
2004-12-16 18:29 ` Alex R. Mosteo
replies disabled

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