Reverse a list

Richard Gaskin ambassador at
Mon Feb 16 18:55:54 EST 2015

Bernd wrote:

> funny, nobody likes "private"
> It save up to 20 % all else equal.
> On about 44000 lines 5 items on each line
> with private 86 ms, without 106 ms LC 6.7.2
> with private roughly 180 ms, without 200 ms on LC 7.0.2 rc2 (times vary much
> more on LC 7.0.2 rc2 than on LC 6.7.2

Ooooh, good find!  I just ran a quick test:

on mouseUp
    put 100000 into n
    put the millisecs into t
    repeat n
       put Foo1() into r2
    end repeat
    put the millisecs - t into t1
    put the millisecs into t
    repeat n
       put Foo2() into r2
    end repeat
    put the millisecs - t into t2
    put t1 && t2
end mouseUp

function Foo1
    return "Hello"
end Foo1

private function Foo2
    return "Hello"
end Foo2

95 49

As with speed differences with the various forms of "repeat", this is 
also somewhat intuitive once you pause and think about it, given the 
variety of ways public handlers can be accessed and the extremely narrow 
scope of private routines.

But even then, I must admit that the speed difference is larger than I 
could have anticipated.  I would imagine that a handler in the same 
script as the caller would be faster than having it just about any other 
place, but to limit its scope trims the execution time by a surprising 

I think my new habit is to declare everything as private unless I know I 
need it available to other scripts.

Thanks again.  Excellent discovery.

  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  Ambassador at      

More information about the Use-livecode mailing list