[Biococoa-dev] Caching the NSArray of BCSymbol

Charles Parnot charles.parnot at gmail.com
Wed Jul 6 13:39:19 EDT 2005


>> I thought of that too initially, but more recently I thought:
>> * if the sequence is immutable, the developer could cache it  
>> outside of the framework, no need to do it in the framework
>> * if the sequence is mutable, caching means a lot of additional  
>> code to keep the array in sync for all the methods where the  
>> sequence changes; which probably means we should not do it now,  
>> but leave it for the future *if* the need arises.
>>
>
> Do you mean, you don't want to implement a mutable version of a  
> sequence class for now? I really need it, so we should build both,  
> mutable and immutable sequences.
>
> Phil

No!! (actually, we don't even have immutable sequences at this  
point). I mean the following.

In which situations would a developer using the framework need to  
repeatedly access the NSArray of BCSymbols and not want to cache it  
herself? That would mean the sequence keep changing and she keeps  
accessing the array. Then, to be efficient, the updating of the  
NSArray has to be done in parrallel to all the changes in the  
sequence. Which means additional code a little bit everywhere, in  
fact in every place where the sequence is modified. I don't think it  
is worth the trouble at this point.

Even then, like Alex pointed out, I don't really see any situations  
where the above AND performance would be needed.

In all other situations (immutable sequences or mutable sequences  
that the user of the framework will not modify while using the  
NSArray), the caching is easy not very useful, as the user will  
probably do it herself without even thinking about it:
     NSArray *myArray = [sequence symbolArray];
     .... use the array ...
I am not even sure we could call that 'caching' ;-)

charles

--
Xgrid-at-Stanford
Help science move fast forward:
http://cmgm.stanford.edu/~cparnot/xgrid-stanford

Charles Parnot
charles.parnot at gmail.com






More information about the Biococoa-dev mailing list