valueDiff for arrays?

Mark Waddingham mark at livecode.com
Tue Aug 7 17:21:25 EDT 2018


On 2018-08-07 17:15, Mark Wieder via use-livecode wrote:
> On 08/06/2018 08:18 PM, Mark Waddingham via use-livecode wrote:
>> I'd expect that for two reasons.
>> 
>> The first is that all array keys are interred strings (names) so 
>> integers need to first be converted to strings and then hashed into a 
>> name and then hashed to the slot in the arrays hash table.
> 
> I thought at some point we had talked about numeric arrarys (as
> opposed to hashes) if all the keys were numbers. That's why I filled
> the array that way. Is that not the case? Can we put that one to bed?

All arrays are string-keyed currently.

However, the engine treats arrays which have all integer (string) keys 
starting at one and are dense (i.e. the number of elements == max(all 
keys)) from ones that aren't.

The fact the keys are still strings is an implementation detail really - 
although one which does leave room for optimization (see the reply I 
wrote about PHP7 - particularly the notion of tagged ptrs for integers).

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps





More information about the use-livecode mailing list