valueDiff for arrays?

Mark Waddingham mark at livecode.com
Sat Aug 4 15:12:40 EDT 2018


On 2018-08-04 21:00, Brian Milby via use-livecode wrote:
> Plugins should probably be de-scriptified for distribution for this
> reason.  A similar argument could be made for some IDE library code 
> too.  I
> have to wonder if there is any performance impact to the number of 
> stacks
> the IDE has to deal with now that so much is scriptified.  (The list of
> stacks is a linked list and finding a stack by name goes through the 
> list
> at least in one spot.).  I've been thinking of how to test this sort of
> thing to measure it

Indeed that would be interesting - I think @Monte proposed a patch to 
make stack-by-filename lookups hash-table based recently (it was attempt 
to fix an unrelated thing which was more important - and I'm not sure 
the speed improvement necessarily justified the extra code complexity - 
until we can abstract the whole caching things logic to a common 
pattern). Certainly making the stack list hash-by-name (like control 
id's per stack) would probably help. Although there are a few salient 
details which make them quite a bit more complex than the id case - e.g. 
substacks can have the same name as a mainstack.

> It would be similar to how copy-on-write does incur a small amount of
> overhead when compared to pass-by-reference that was demonstrated in an
> earlier discussion.  The result there was that if you need to optimize 
> for
> speed, reference is still helpful.  If you are purely concerned about
> memory usage, then it isn't needed.

Again - interesting - can you pull out that exact case, it is a little 
surprising (which makes me wonder whether there are some specific 
details it which are actually exceptionally important). For example:

on foo @xValue
   return xValue[5]
end foo

on bar pValue
   return pValue[5]
end bar

on testFoo pArray
   put "baz" into pArray[1][2][3][4]
   repeat 10000 times
     foo pArray[1][2][3][4]
   end repeat
end testFoo

on testBar pArray
   put "baz" into pArray[1][2][3][4]
   repeat 10000 times
     bar pArray[1][2][3][4]
   end repeat
end testBar

You should find that whilst these two things do exactly the same thing 
that testFoo will be a lot slower than testBar.

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