The Best Solution


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Darrel may recognize some of his tricks
    Ha,

    I knew that stuff would come in handy some day.

    Nice comparisons.
    <br>
    DT

  2. #2
    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.

  3. #3
    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.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Ha,

    I knew that stuff would come in handy some day.
    yup, kinda REALLY handy stuff. I use it a lot here in a custom INCLUDE FILE! YES you heard me, STEVE USE INCLUDE FILES NOW
    (refer to those http://www.picbasic.co.uk/forum/showthread.php?t=2108 and http://www.picbasic.co.uk/forum/showthread.php?t=2400 )

    So it's a kind of personal mix of old and pretty old previous thread

    Those wanting to know where the idea came from, i think those bellow are the main resources
    See what you have done with me !
    Last edited by mister_e; - 28th May 2007 at 04:07.
    Steve

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

  5. #5
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Code:
    IF (ml_value[temp]-$5B)<$27 THEN
        Summe_alarm.0[temp]=0
    ELSE
        summe_alarm.0[temp]=1
    ENDIF
    When used with FOR NEXT or any of the others, this should further cut time and code space .....

    ASM anyone?
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

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


    Did you find this post helpful? Yes | No

    Default

    Worth to measure it... do we need to start a 'coding challenge' here... if so, i'll warn Darrel, he like that
    Steve

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

  7. #7
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by mister_e View Post
    Worth to measure it... do we need to start a 'coding challenge' here... if so, i'll warn Darrel, he like that
    I didn't take the time to check everything except code words for a few cases. It looks like it saves some; the amount depends on what it is inserted between.

    you might want to warn Bruce as well
    Last edited by paul borgmeier; - 28th May 2007 at 05:23. Reason: added more detail
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

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


    Did you find this post helpful? Yes | No

    Default

    Yes but first, we have to get rid of the .0[temp] for speed (see previous post).

    i'm thinking of some kind of aliasing... but, i keep thinking...

    Yeah, it's getting interesting
    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