by Wilfred Verkley >> Sun, 28 Nov 1999 21:21:11 GMT
Im storing a large binary value on an object (a company logo).
Out of habit, I define the following methods for it:
setLogo (value : Binary)begin
fLogo := value;
end;
getLogo : Binary;begin
return fLogo;
end;
But im thinking (this happens slowly on a monday morning), this isn't the most efficient way of passing around a large amount of memory (it gets copied to and from the stack), so I redefine the functions as follows:
setLogo (value : Binary constant)begin
fLogo := value;
end;
getLogo (value : Binary output)begin
value := fLogo;
end;
This ensures the value is passed by reference, and that memory is only copied once (fLogo := value or value := fLogo).
Is this necessary? Is jade smart enough to pass large binaries around by reference unless it needs to?
Delphi reference counts its strings (same as binaries/strings in jade), so their not actually copied to a new memory area unless their changed. This could be done in jade as well?
Wilfred.