Most Effecient way to pass around a large binary value

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Most Effecient way to pass around a large binary value

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:20 pm

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.

Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 22 guests