Repeat for each line of a variable or field?

Tore Nilsen tore.nilsen at me.com
Sat Jan 12 11:48:00 EST 2019


When using a field with close to 45000 lines, the second (using the lines of the field) version takes on average 23 milliseconds, whereas using a variable takes on average 15 milliseconds. For a field /variable with 5000 lines  the difference is about 2 milliseconds here. The actual speed and difference will vary according to your hardware I guess.

Best regards
Tore Nilsen



> 12. jan. 2019 kl. 17:01 skrev David Epstein via use-livecode <use-livecode at lists.runrev.com>:
> 
> I've done a little bit of speed testing showing extremely slight differences, but wonder if anyone who understands the "engine" can advise on this:
> 
> Is there a difference between these two approaches?
> 
> (1) put fld 1 into txt; repeat for each line k in txt; etc.
> 
> and
> (2) repeat for each line k in fld 1; etc.
> 
> For no very good reason, I tend to do (1), but have begun to wonder:  for a very lengthy field 1, does my writing to a variable use up more RAM, and so perhaps injure performance?  Or is the engine in effect writing to a variable either way?  Is a variable read more quickly than a field?  
> 
> Many thanks.
> David Epstein
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list