CubicDesign wrote:
>> Never, ever, write a record to disk if it isn't declared as "packed." 
>
> The speed is important in this piece of code!

You've actually measured, and the time difference between accessing 
packed and unpacked records is significant in your program? I doubt that.

> So how can I unpack it after I load it from disk?

Assign the fields from the on-disk version of your record to the 
in-memory version. You'll have two record declarations and two variables.

> Should I load the packed version of CromaMX from disk then move it into 
> a non-packed array for speed?
> How? Direct assignation won't work, System.Copy won't work also. The 
> only way will be to copy elements one by one in a for loop. Is this the 
> best way?

The best and only way.

> var
>  CromaMX       = packed array of TSample;
>  CromaMXFast =            array of TSample;

The "packed" reserved word has no effect on arrays anymore. Arrays are 
always packed in Delphi.

> begin
>  LoadFromDisk(CromaMX);
>  CromaMXFast:= CromaMX;        <-- won't work
> end;

Assignment of dynamic arrays doesn't make a new copy anyway.

-- 
Rob
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to