Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:25 08 Oct 2026 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : how to make programms in mmbasic faster...

Author Message
hhtg1968
Senior Member

Joined: 25/05/2023
Location: Germany
Posts: 236
Posted: 02:14pm 07 Oct 2026
Copy link to clipboard 
Print this post

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: Germany
Posts: 236
Posted: 02:42pm 07 Oct 2026
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 11961
Posted: 03:57pm 07 Oct 2026
Copy link to clipboard 
Print this post

Here you go. This will be included in the next release package

MMBasic_Performance_Guide.pdf
 
hhtg1968
Senior Member

Joined: 25/05/2023
Location: Germany
Posts: 236
Posted: 04:52pm 07 Oct 2026
Copy link to clipboard 
Print this post

that is fine. thank you.
 
hhtg1968
Senior Member

Joined: 25/05/2023
Location: Germany
Posts: 236
Posted: 05:33pm 07 Oct 2026
Copy link to clipboard 
Print this post

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: Canada
Posts: 665
Posted: 07:00pm 07 Oct 2026
Copy link to clipboard 
Print this post

  matherp said  Here you go. This will be included in the next release package

MMBasic_Performance_Guide.pdf


That's a very interesting read thanks! I learned a lot.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026