|
Forum Index : Microcontroller and PC projects : how to make programms in mmbasic faster...
| Author | Message | ||||
| hhtg1968 Senior Member Joined: 25/05/2023 Location: GermanyPosts: 236 |
how to make programms in mmbasic faster... on my 40 year old amstrad cpc I am able to optimize speed and i know how to because i wrote the compiler itself. with mmbasic version7 it is so wonderful to speed up the programs, but I want to do that more exactly. on mmbasic I am not sure about the exact method to speed up. Is this question already discussed here in the forum? here my questions (some of many): 1. One command per line or more? (a=b b=c c=d or a=b:b=c:c=d) 2. "for ... next" or loop? (for i=0 to 9 next or i=0 do inc i loop until i>9) 3. "next x" or "next"? I already read: "next" without x correct? 4. complicated expression or variable? (for n=1 to a+b+c+sqr(x)... or m=a+b+c+sqr(x)... for n=1 to m... one question is whether the condition in the for-loop ist calculated every round) 5. constants or numbers? (print 10 or const p=10 ... print p or line 10,10,100,100,,, or x=... y=... x1=... y1=... line x,y,x1,y1,,, ) some parsers are slower by reading a number from the ascii text than getting the value of a var or constant... 6. I read the infos of mmbasic v7...b7: call "subroutine" is faster than "subroutine"? 7. long names of variables? in my old basic dialects programs with long names of vars (etc) are slower because of the need of interpreting. that did not matter after compiling. how in mmbasic (compiled and not compiled)? and so on... |
||||
| hhtg1968 Senior Member Joined: 25/05/2023 Location: GermanyPosts: 236 |
ok. I tested it by a few lines: for to is faster than do loop do loop is faster than goto label I will try further. those who create mmbasic know that much more exact... |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11961 |
Here you go. This will be included in the next release package MMBasic_Performance_Guide.pdf |
||||
| hhtg1968 Senior Member Joined: 25/05/2023 Location: GermanyPosts: 236 |
that is fine. thank you. |
||||
| hhtg1968 Senior Member Joined: 25/05/2023 Location: GermanyPosts: 236 |
The performance guide is great! perhaps there will be a time when I will have time to understand mmb2csub. |
||||
| PeteCotton Guru Joined: 13/08/2020 Location: CanadaPosts: 665 |
That's a very interesting read thanks! I learned a lot. |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |