The Best Solution


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Post

    Thanks for sharing those figures with us Steve. Repeat is the same as a conditional (DO Loop) ? Main reason DO's are faster is because unlike For Nexts, they don't have counters. In VB, (For Nexts) are idiot proof making them relatively bloated & slow.
    <br/>
    Last edited by T.Jackson; - 28th May 2007 at 01:23.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by T.Jackson View Post
    Repeat is the same as a conditional (DO Loop) ?
    Yes indeed.

    Main reason DO's are faster is because unlike For Nexts, they don't have counters.
    mmm yes and no. Here what reduce the speed is more likely the .0[Temp] stuff. Let's see

    Code:
    @   SIZESTART
        for temp = 0 to 7
            next temp
    @   SIZEEND "FOR-TO-NEXT"
     
    @   SIZESTART
        temp = 0
        repeat
            temp=temp+1
            until temp = 8
    @  SIZEEND "REPEAT - UNTIL"

    FOR-TO-NEXT: 13 WORDS, 113 UsEC
    REPEAT - UNTIL: 9 WORDS, 72 UsEC
    about the same code space, 41uSec of difference in the speed for the whole thing.

    But now, have a look at this
    Code:
    @   SIZESTART
        Summe_Alarm.0 = 0
    @   SIZEEND "Direct Bit Addressing"
     
    @   SIZESTART
        temp = 0
        summe_Alarm.0[temp] = 0
    @  SIZEEND ".0[Temp] stuff"

    Direct Byte Addressing: 1 WORDS, 1 UsEC
    .0[Temp] stuff: 10 WORDS, 47 UsEC
    That's 46 uSec BY single instructions/lines like that. So... much revealant when you use them a loop that the loop itself.
    Last edited by mister_e; - 28th May 2007 at 04:56.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Strange I2C problem (and solution)
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th December 2008, 19:14
  2. Replies: 6
    Last Post: - 20th September 2008, 12:28
  3. Replies: 7
    Last Post: - 7th February 2008, 09:46
  4. Need PC software solution
    By mister_e in forum Off Topic
    Replies: 9
    Last Post: - 27th November 2005, 02:18
  5. Battery Solution
    By Keith in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd July 2005, 06:07

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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