Re: Storing large number of values in 2D array
- From: jacob navia <jacob@xxxxxxxxxxxxxxxx>
- Date: Sat, 21 Oct 2006 00:32:56 +0200
Al Balmer wrote:
On Fri, 20 Oct 2006 20:46:28 +0200, jacob navia
<jacob@xxxxxxxxxxxxxxxx> wrote:
rajus wrote:
I want to store the (x,y) coordinates of about 10,000 points in a 2D
array.How can I store them and retrieve them later?
You have 10 000 x 2 points i.e. 20 000 points to store.
To minimize space you could use 12 bits (coordinates up
to 4096x4096) and store 5 points per 64 bits, making it
around 32 000 bytes for the 2D array.
Of course, the extra code required to do this would probably make up
for the saved space. I like Lew's suggestion, using whatever size
integer is appropriate.
I do not think that a simple code for accessing a 2D 12 bit
integer array would make 14 000 bytes of code in C.
At most it would take 150-200 bytes of code, maybe more in RISC
processors, but never 12 000 bytes.
But that was a memory efficient solution, good for embedded
systems where memory considerations are important.
I proposed also a 16 bit solution, not knowing precisely the context.
What is important to emphasize is that integers of bit-size other
than 8-16-32 are possible, and can be a space saving in many situations.
I have seen proposals to add to C
int:12 a;
meaning a is a 12 bit integer. This, with support for array notation of
those integers would be interesting in systems where memory is important
jacob
.
- References:
- Storing large number of values in 2D array
- From: rajus
- Re: Storing large number of values in 2D array
- From: jacob navia
- Re: Storing large number of values in 2D array
- From: Al Balmer
- Storing large number of values in 2D array
- Prev by Date: Re: Change Variable in Server
- Next by Date: Re: host association
- Previous by thread: Re: Storing large number of values in 2D array
- Next by thread: Re: Storing large number of values in 2D array
- Index(es):
Relevant Pages
|