Menu

CODE OPTIMISATION

Help
JANIS
2018-12-27
2020-01-04
<< < 1 2 3 4 (Page 4 of 4)
  • stan cartwright

    stan cartwright - 2020-01-02

    I thought it was a code optimisation post.
    I write glcd gcb graphics programs and "the need for speed" is important for the visuals.
    I do not use logical if x=1 and y=2 then as it tests both conditions even if x<>1.
    If you want to see my point, look at my pong code. More multiple if thens than you could wave a stick at.
    Obvious things for moving graphics is don't erase, then do calculations for new then plot,print,draw whatever....do the calcs first as more variables so erasing and redrawing are faster.
    I noticed goto instruction used and it can be hard to make an alternative that is as efficient.
    edit- it's called structured programing.... ie easier to understandable code?
    I have found goto the fastest and mem use best but it's not just frowned about it's not allowed in gcb projects.
    Well there's goto used in the glcb libs...I was going to mention it but..

    '''Displays a character in a larger font
    Sub DrawBigChar (In CharLocX as Word, In CharLocY as Word, In CharCode, Optional In  Color as word = GLCDForeground )
        Dim LocX , LocY as Word
        if CharCode <=126 Then
           CharCode -=32
           Goto Tables
        end if
        if CharCode <=210 Then
           CharCode -=33
           Goto Tables
        end if
        if CharCode <= 250 Then
           CharCode -=34
           Goto Tables
        end if
    

    so there :)

     

    Last edit: stan cartwright 2020-01-02
  • JANIS

    JANIS - 2020-01-04

    Thank you all for the suggestions! I'll keep that in mind when I upgrade code for the charger again. Now it performs its functions :)

     
<< < 1 2 3 4 (Page 4 of 4)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.