I want to store a large result set from database in memory. Every record has variable length and access time must be as fast as arrays. What is the best way to implement this? I was thinking of keeping offsets in a separate table and storing all of the records consecutively? Is it odd? (Programming Language: Delphi)
Looping through a two-dimensional array in a asp.net MVC View
as3 referencing members of an array not explicitly defined
How to merge sub-arrays within an array in Ruby?
In Delphi 7 at least, it is implemented as an arrary of pointers.
Is 'for x in array' always result in sorted x? [Python/NumPy]
You can use the capacity property to pre allocate the list ahead of time if you know how many results are coming back..
how to put an array character into the equation?
The list will automatically grow if it runs out of space.
Accessing an array out of bounds gives no error, why?
How much it grows by depends on how big the list is.
Marshalling an unknown Array size
Trying to make a 2D array of lists
Take a look at the source for the classes unit to see what it's doing.. Edit: Also in D2009 genric support was added to TList which makes it a bit nicer to use..
You won't have to deal with offsets, in that case, and lookups will be constant time..
You'd copy the table from disk to the memory table, and then can use all the normal database operations at memory speed.
I know this works well in DBISAM..
How large is that resultset?.
type pMyRecord : ^TMyRecord; ...
var p : pMyRecord; ...
New(p); with p^ do begin ...