Speed test for literals and variables

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Speed test for literals and variables

Post by dunbarx » Wed Jan 28, 2015 9:59 pm

This seems counterintuitive to me.

Code: Select all

on mouseUp
   put the ticks into tStart
   put "x" into tTest
   repeat 15000000
      put tTest into cc
      --put "abc" into cc  --this is faster
   end repeat
   answer the ticks - tStart
end mouseUp
Not that it matters much, and the difference is only about 3% (about 59 ticks vs 61, fairly repeatable), but the variable version lags the literal version. iMac, OS 10.9.5, LC 6.7.

Esoterica, but why?

Craig Newman

Post Reply