[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: large arrays - how to store?
From: |
Guy Harrison |
Subject: |
Re: large arrays - how to store? |
Date: |
Wed, 16 Feb 2005 00:01:27 GMT |
User-agent: |
KNode/0.8.1 |
Paul Schneider wrote:
> Guy Harrison wrote:
[snip]
>> "Dynamic allocation" is still the stock answer. Consider also grabbing
>> some older books which cover "batch processing". Most processing is
>> boring repetitive stuff. Half the battle with programming is losing
>> conventional thought. Sparse arrays are a bonus. Don't program for them
>> unless you have reason to.
>>
> Thanks for your answer. My problem is definitely not even remotely
> sparse. It's all dense vector/matrix matrix/matrix stuff.
In that case, without some predictive algorithm, you're looking at random
access.
> I don't know much about compilers and operating systems. Maybe this is
> why it seems so unintuitive to me to throw away the advantage?
It's not an advantage. It's a balance.
> to know
> everything at compile time. In all the experiments I performed, static
> allocation itself and working with statically allocated structures was
> much faster than the dynamic counterpart.
Did you take linker time & runtime startup into that equation?
In most situations "static" involves zeroing the space. Dynamic allocation
is uninitialised. It's hard to advise further without code.