old habits are hard to break

Dr. Hawkins dochawk at gmail.com
Sat Jun 22 11:26:38 EDT 2013


On Sat, Jun 22, 2013 at 6:57 AM, Peter M. Brigham <pmbrig at gmail.com> wrote:
> Running the comparison on my old MacBook Core 2 Duo within a high-n repeat loop I get
>
> script 1: 2.177881 seconds
> script 2: 1.962642 seconds
>
> so the intermediate shallow array saves some time, presumably increasingly more with deeper arrays.

Now *that* fascinates me . . . I was wondering if the copy to another
variable was faster than referencing the array a second time (which
might not even be necessary).  But you've found that actually
*copying* part of the array is faster than a second reference . . .

My arrays are only two deep, but the first index can get fairly large
(on the one I was working on, I think it's about 500, likely to get to
600 or 700 by the time I'm done.

In C or Fortran, I believe that the second reference would be
optimized away, but . . .
> OTOH, long variable names do nothing to shave clock cycles at runtime, I think that
>whatever the variable names it gets compiled to the same code.

Now if I could only convince my fingers of this  . . .

:)

Thanks


-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462




More information about the use-livecode mailing list