Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Do 'if' statements branch code in Lua?

                  
   
  1. #11
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    87

    Default

    Here is the kicker though, originally I had "State = 0" so the if statement was false, the IfTest was faster the NoOfTest ??? I have to do a similar test at some point in C/C++ and use the -03 flag and see how big (if any) a difference it makes.

  2. #12
    DCEmu Coder dalejrrocks's Avatar
    Join Date
    Feb 2006
    Location
    Alabama
    Age
    34
    Posts
    240
    Rep Power
    71

    Default

    well, that makes sense. i guess an if loop can be faster than the for one sometimes. but like you said there's not really a significant difference in speed.

  3. #13
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    87

    Default

    I suppose it is due to scripts being interpreted rather then pre-compiled and there is no (?) optimisation stage when the script is ran 'on the fly' so the difference is negible if any.

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •