Should size be extended to variables?

Mark Waddingham mark at livecode.com
Sat Aug 20 14:44:19 EDT 2016


For what purpose?

The key thing here is that the number of bytes a value currently takes up in memory is not actually a good measure for how much memory is being used because instances of values can be shared.

To put it another way, the memory footprint used by two arrays will not necessarily be the same as the sum of the memory footprint of the two arrays measured separately as they might share the actual memory used by any value in either array. e.g the values used to store the keys in an array are *always* shared.

You can get a reasonable approximation of the memory footprint of an array in isolation by taking the length of its arrayencoding.

For optimization purposes the best approach is to measure the amount of memory *actually* in use before and after any particular operation you perform - just as you do with time when profiling for speed (rather than memory footprint).

Warmest regards,

Mark.

Sent from my iPhone

> On 20 Aug 2016, at 18:01, Mark Talluto <mark at canelasoftware.com> wrote:
> 
> Yes. Arrays.
> 
> Mark
> 
> On Saturday, August 20, 2016, Richard Gaskin <ambassador at fourthworld.com>
> wrote:
> 
>> Currently the length function returns the number of characters in the data
>> passed to it, but there may be times when what we want to know is the
>> actual size of the data in bytes, which may vary from the number of
>> characters.
>> 
>> The size function seems a good fit for this, since it's all about bytes.
>> 
>> Should I submit an enhancement request to extend the size function to work
>> with variables as it does for objects?
>> 
>> Any other options I should consider before submitting a request for some
>> means of determining data length in bytes?
>> 
>> --
>> Richard Gaskin
>> Fourth World Systems
>> Software Design and Development for the Desktop, Mobile, and the Web
>> ____________________________________________________________________
>> Ambassador at FourthWorld.com                http://www.FourthWorld.com
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> -- 
> Best regards,
> Mark Talluto
> 
> 
> 
> CANELA Software, Inc.
> 28544 Old Town Front Street #305
> Temecula, CA 92590
> tel: 310-856-9926
> fax: 888-339-6685
> international:  +1 310 856 9926
> livecloud.io <http://www.livecloud.io/>
> canelasoftware.com <http://www.canelasoftware.com/>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the Use-livecode mailing list