![]() |
Forum Index : Microcontroller and PC projects : CMM2 V5.05.06exp: Huge performance improvement - please test
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
MauroXavier Guru ![]() Joined: 06/03/2016 Location: BrazilPosts: 303 |
I have tested the updated DEMOX and it worked perfectly... AND IS EVEN FASTER YET! Fantastic work, Peter! |
||||
sc05027 Newbie ![]() Joined: 01/01/2015 Location: Hong KongPosts: 10 |
Based on my understanding on this thread, to make a program run faster in this version of MMBasic, it is better to preventing hash collisions between global variable names and between local variable names (not just prevent using same variable names). So, I wrote a small FNV-1a function to help me identify the hash result, I can use this to help naming variables wiser. However, I have no idea which case the CMM2 firmware used in identifying variable names, upper case or lower case? I hope someone who has access to the source code help. Thanks. Function FNV1a(varname As string) As integer Local integer FNVPrime = 16777619 'source from wiki FNV function Local integer FNVoffsetbasis = 2166136261 Local integer hash = FNVoffsetbasis Local integer i For i = 1 To Len(varname) hash = hash Xor Asc(UCase$(Mid$(varname,i,1))) 'UCase$ / LCase$? hash = hash * FNVPrime Next FNV1a = hash And 511 End Function |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
In the latest release local and global variables are separate so you only need to check local to local and global to global All variables are converted to upper case before hashing NB you need to round up the length of variables to a multiple of 4 by adding 0 characters to get the hash I use Edited 2020-10-24 17:28 by matherp |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
One final tweak - function lookup is now hashed and the maximum number of functions increased to 512. Gives me another 5% or more improvement on most tests CMM2V1.5.zip ![]() |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4299 |
Very impressive, the unoptimised version of Z-MIM now reaches 1000 zmips. ![]() I don't suppose there is any chance you'll stop now so that I can smoke test the Welcome Tape against a fixed target ? Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
|
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4299 |
... bugger, with the new firmware (c.f. RC6) the new "Welcome Tape" menu is crapping out with a "System fault" almost immediately ... watch this space. MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
MauroXavier Guru ![]() Joined: 06/03/2016 Location: BrazilPosts: 303 |
Peter, Almost all my games now give me "Unknown command". Try the last version of Gauntlet on GitHub, you will see: Error on INTRO.INC line 29: Unknown command In all situations, is like something in INC files isnīt found. |
||||
MauroXavier Guru ![]() Joined: 06/03/2016 Location: BrazilPosts: 303 |
I found the "bug"... The CLEAR command mess up the things. I removed the CLEAR command and itīs all fixed. Edited 2020-10-24 23:21 by MauroXavier |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
I've obviously missed something. Leave it with me. Thwill: don't waste any time until I re-post |
||||
MauroXavier Guru ![]() Joined: 06/03/2016 Location: BrazilPosts: 303 |
WHAAAT?? GAUNTLET is now perfected in this firmware version, it reached 80 enemies on the screen at 20 FPS with 4 PLAYERS! This is exactly what I was trying to do, thanks to you now I can go on the development of GAUNTLET with no effort about optimization. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
Sorry about that - CLEAR command was causing the problem CMM2V1.5.zip |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4299 |
Alas that hasn't helped me ... you call my style weird, the idea of calling CLEAR within a program seems downright bizarre to me. I think mp3 playback is now crapping out randomly with a "System fault" as the Welcome Tape menu program seems to be dying whilst just sitting in a loop waiting for keyboard input. I don't suppose you can be persuaded to download: https://github.com/thwill1000/cmm2-welcome/archive/develop-r0.5.zip and RUN "/welcome/menu/menu.bas" ? Tom Edited 2020-10-25 00:19 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
MauroXavier Guru ![]() Joined: 06/03/2016 Location: BrazilPosts: 303 |
Sorry, I never called your style weird, when talking about fun (not work), I think anyone can make a program as wish. In the previous firmware, when running the DEMOX, in each part of the demo when I used CLEAR command and declared only the variables and arrays used in that part of the demo, the speed gain was IMPRESSIVE! This was one of the tricks to achieving the speed in early firmware. Now I believe the CLEAR command is not relevant as I removed it on my programs and doesn't show any difference of speed anymore. In any case, CLEAR can be used when you have a program that declares too many variables and arrays and you really want to "clear all the house" without using ERASE for each declared variables and arrays. When talking about limited memory systems (MSX BASIC in my time) or split memory type (slow and fast memory types in the same system in a linear address, as the CMM2), isnīt bizarre for me to use the CLEAR command. Edited 2020-10-25 00:47 by MauroXavier |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4299 |
No you didn't, that comment was directed at Peter who likes to remark that some of the things that I do are "odd" when commenting on the latest bizarre edge condition bug or feature request that I've reported or made. No offence, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
I had a quick look but there are so many things that may be the issue in the complex way you do things I don't have a hope of finding the issue we.is_quit_key% = UCase$(k$) = WE.QUIT_KEY$ ? One thing to look at is any use of EXECUTE for other than RUN Please try and narrow it down Given that "normal" programs run so much faster the optimisations are not something I'm going to back out |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4299 |
I don't know what you mean, that is just the BASIC equivalent of: a = b == c it's just that the BASIC assignment and equals operator are the same ![]() I'm suspect that just some subtle timing change means the mp3 playing is not "pinging the watchdog" sufficiently. Anyhow I'll move some things around, and I guess there is a good chance the issue will disappear mysteriously. I'm not suggesting you should, but I think your definition of "normal" will have to change as developers increasingly push the system. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4299 |
OK, not sure this is the same bug but, "A:/crash.bas" Function we.wait_for_key$() Local k$ Do While k$ = "" : k$ = Inkey$ : Loop we.wait_for_key$ = k$ End Function Play MP3 "TweakerRaySpaceFlight-160kb.mp3" Do k$ = we.wait_for_key$() Loop Download the MP3 file here: https://github.com/thwill1000/cmm2-welcome/raw/develop-r0.5/menu/TweakerRaySpaceFlight-160kb.mp3 1. EDIT "crash.bas" 2. F2 3. System fault Doesn't happen if you just RUN "crash.bas" from the command line. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
No its not that. I disabled the watchdog to test that possibility. I suspect the issue is that something is causing the variable stack, variable hash table or function has table to be corrupted or wrong. Does it run on any of these posts on this thread? My guess is variable stack and that it is EXECUTE causing the problem |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4299 |
OK, see my last post, definitely no EXECUTE there, but also may be a different bug. If you find/fix that bug and I'm still experiencing an issue I'll work back through the experimental releases to see when it first appeared, I assume all the links are still valid, or is it a single link and you just keep updating the target? Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |