Shop OBEX P1 Docs P2 Docs Learn Events
Did you know? — Parallax Forums

Did you know?

KyeKye Posts: 2,200
edited 2012-05-11 23:14 in Propeller 1
This is more efficient...
repeat
while(true)

Than this...
repeat while(true)

In fact, the first statement saves 2 bytes. This is useful when you have some code that is just spinning in a one liner repeat loop with no statements inside of the loop.

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-05-11 21:52
    No I didn't know. I use the second version frequently. I'll need to change my habit.

    Do you know if there's a time difference between the two loops?
  • kwinnkwinn Posts: 8,697
    edited 2012-05-11 22:02
    If one is 2 bytes longer the interpreter has to read those bytes so it must take longer to execute.
  • kuronekokuroneko Posts: 3,623
    edited 2012-05-11 23:14
    kwinn wrote: »
    If one is 2 bytes longer the interpreter has to read those bytes so it must take longer to execute.
    While this is true here, shorter is not always faster. See the [thread=137018]Spin speed up[/thread] thread for more details.
Sign In or Register to comment.