Shop OBEX P1 Docs P2 Docs Learn Events
question about Program Execution Speed — Parallax Forums

question about Program Execution Speed

japerjaper Posts: 105
edited 2005-09-26 17:13 in BASIC Stamp
hello

on Program Execution Speed of the basic stamp module is instruction speed by "command"
or "by line of code" ? or something all together

any help would be helpful
japer

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-09-26 14:12
    japer -

    Essentially it's by "command" or function, but there are some exceptions. Since Parallax PBASIC is an interpretive language, one has to realize that there is token fetch time as well, beyond the actual instruction execution time, and that may vary by the particular command or function you are using. So too instructions that access outside entities (SERIN, PULSEIN, SHIFTIN, etc) may depend on those entities themselves, and their particular response/wait times.

    You may find this link helpful for empirical timings of some of the more common PBASIC commands, when used on the BS-2 or BS-2X:
    ··· http://www.emesystems.com/BS2speed.htm

    Thanks go to Dr. Tracy Allen for all of that timing work.

    Regards,

    Bruce Bates
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-09-26 14:16
    Instruction speed is by 'keyword'. Each 'keyword' gets converted into one or a few 'tokens'. A 'token' is an integer (or byte) which selects a particular set of run-time code to implement that function.

    The BS2 runs about 4000 PBasic Instructions Per Second. There are a few instructions (SERIN/SEROUT, SHIFTIN/SHIFTOUT, PAUSE) whose execution time is dependent on the data being sent/recieved or pause time.

    So X = X + 1 would be translated into a token for the "+" which would select an addition routine from the run-time EEPROM in the BS2. It would then look up the 'X', look up the '1', do the addition, and store the result in the location X had been using. And this whole process would take around 300 uSec.
  • japerjaper Posts: 105
    edited 2005-09-26 17:13
    bruce

    that was an excellent link thank you

    thanks for both allan and bruces advice
    japer
Sign In or Register to comment.