Okay, I think I'm brain damaged -- nope, I figured it out

Richard Gaskin ambassador at fourthworld.com
Sat Sep 14 12:55:36 EDT 2013


Roger Eller wrote:

 > I am fascinated by the benchmarking scripts you have devised, but
 > if the destinations are the same, why in the world would someone
 > purposefully choose the moped to get there, especially when the
 > jet plane is available?

It's hard to find parking for a jet. :)

Mopeds, cars, trucks, and even bicycles have useful roles among 
transportation options, each having its own strengths and weaknesses for 
a given task.  I prefer using my bicycle for any trip under 5 miles, and 
frequently use it for 10 miles or more, but I wouldn't choose it when I 
need to get from Pasadena to Boston (though I once met a 65-year-old 
gentleman who did exactly that, but that's another story and he had lots 
of time on his hands <g>).

There are times when passing by reference is a really good thing to do, 
and times when it's not at all good idea, like if you need an altered 
output but also need to keep the original intact.

Similarly, "repeat for each" is much faster than "repeat with", but if 
you need to alter the chunk being parsed within the loop the former 
won't let you do that, since it's able to achieve its speed only by 
enforcing an assumption up front that the chunk won't change during the 
loop.

And sometimes we need to put before, and sometimes put after, and while 
it's conceivable the engine might be able to figure out our intentions 
to reverse the operation internally to use the faster form, no doubt 
there would be cases where it would guess wrong.

There are likely many ways the engine can be further optimized for 
ever-greater efficiency, just as Raney took the time so long ago to 
optimize the "put after" so that it no longer made a copy but did a 
resize instead.

But we can also expect there will always be a need for us to decide 
which algorithm best fits the problem at hand.

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  Follow me on Twitter:  http://twitter.com/FourthWorldSys





More information about the use-livecode mailing list