Collection Object -- I need to know your needs.

Shaun Wexler dev at macfoh.com
Tue Aug 1 14:25:44 CDT 2006


On Aug 1, 2006, at 1:41 PM, Ruslan Zasukhin wrote:

> RB Tree inside of BLOB give you ability load this into RAM,
> And do search. Right ?

In storage, only sorted object array is maintained.  In memory, there  
are two buffers:  indexed objects and object index (rb tree), and  
indexes are relative to start of each buffer.  You can perform a  
binary search on the array in storage, or load the sorted array and  
quickly generate a rb tree index (ie b-tree), then the array might  
become unsorted in memory upon insertion/deletion, but can be  
rebalanced later or upon writing back to storage (and you then  
discard the rb tree index).

> But simply sorted array can allow this.

Yes, but at expense of memmove to mutate it = very slow.

> But you cannot search through the whole column.
> I want be able find records which have arrays that contain value 3.
>
> You see? Having index this can be done very fast.

Create an IndexSet class, and store an array of index ranges.  You  
can reduce storage immensely if you steal one bit from the values as  
a flag, thus worst-case count is (maxIndex-minIndex)/2+1 plus the  
object itself.
-- 
Shaun Wexler
MacFOH
http://www.macfoh.com




More information about the Valentina mailing list