Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 23:53 20 Apr 2024 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 : CMM2 V5.05.06exp: Huge performance improvement - please test

     Page 1 of 8    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8570
Posted: 01:29pm 20 Oct 2020
Copy link to clipboard 
Print this post

Please run as many of your programs as possible to test for any issues.
This experimental release implements a full hashing system for variable lookup

CMM2V1.5.zip


V5.05.06exp



V5.05.05

 
qwerty823
Newbie

Joined: 30/07/2020
Location: United States
Posts: 30
Posted: 02:42pm 20 Oct 2020
Copy link to clipboard 
Print this post

Awesome!

I just ran Pete Cotton's Heliblast with this and framerate went from an 10-11 fps to a solid 20.

Also had roughly the same increase for Mauro Xavier's Gauntlet port (though I can't recall the lower bounds, it would drop to less than 10 when it had max monsters on the screen, now it just blips below 20)
 
LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 440
Posted: 02:49pm 20 Oct 2020
Copy link to clipboard 
Print this post

Very nice improvement.
I'll try it today.

Are you thinking adding this experimental variable lookup table to the final version?

I guess this new lookup table has a performance complexity O(1) for the best case, am I right?
What is the current implementation performance complexity?
Edited 2020-10-21 00:50 by LeoNicolas
 
qwerty823
Newbie

Joined: 30/07/2020
Location: United States
Posts: 30
Posted: 03:22pm 20 Oct 2020
Copy link to clipboard 
Print this post

A few updates before I need to get back to work:

When I run my testing program from this thread I get a firmware crash when using a constants file with 1000 constants. With 900 or less, it runs MUCH faster. The 198.236 (first variable case) jumped up to around 207 ms (for 100k iterations), so you take about a 5% hit for the first variable case, but go from almost 11 secs down to around 382 ms for the second case (where the variable would have been number 1002 in the vartbl).

I notice its not quite constant time (O(1)) as I increase the number of constants, but the timings stay real close to that 207 number until I get to around 500 constants, then slowly creeps up.

Either way, huge wins in terms of speed. I really hope this stays, even it takes a bit of tweaking to get it beyond experimental.

Awesome work, as always, Peter.
 
MauroXavier
Guru

Joined: 06/03/2016
Location: Brazil
Posts: 303
Posted: 03:52pm 20 Oct 2020
Copy link to clipboard 
Print this post

I'm anxious to back home to test my games, mainly the INTO THE DARKNESS.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8570
Posted: 04:17pm 20 Oct 2020
Copy link to clipboard 
Print this post

Minor update. There is a maximum of 1024 variables (there always was just not documented). The code now checks for there being too many and gives a sensible error message rather than crashing.


CMM2V1.5.zip


As long as no-one finds any programs that no longer work with this version and that I can't diagnose and fix the change will make it to the V5.05.06 release.

As qwerty823 reports you will see a drop off in  performance when the number of variables exceeds around 500. This is because the hash collisions will increase dramatically as the number of free slots in the 1024 element hash table decreases.

IMHO any program using over 500 variables needs some serious rework

Use MM.INFO(VARCNT) to find how many are active in your programs - worst case will be in the most deeply embedded complex subroutines

For info the hashing algorithm used is FNV-1a with a 32 bit hash key masked to 10 bits
Edited 2020-10-21 02:20 by matherp
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1133
Posted: 04:30pm 20 Oct 2020
Copy link to clipboard 
Print this post

Hi Peter,
you don't intend to reintroduce the "ERASE" command?

Kind regards
Michael
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8570
Posted: 04:36pm 20 Oct 2020
Copy link to clipboard 
Print this post

  Quote  you don't intend to reintroduce the "ERASE" command?


It is there - just missed in the manual together with ERROR
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1133
Posted: 04:43pm 20 Oct 2020
Copy link to clipboard 
Print this post

oops!
 
elk1984

Senior Member

Joined: 11/07/2020
Location: United Kingdom
Posts: 227
Posted: 05:01pm 20 Oct 2020
Copy link to clipboard 
Print this post

Thanks Peter - best kind of upgrade, more performance for no recoding  
 
Barbiani
Newbie

Joined: 18/10/2020
Location: Brazil
Posts: 6
Posted: 08:33pm 20 Oct 2020
Copy link to clipboard 
Print this post

Are you using a version control software? Will be there a patch file that adds the hashing?
Edited 2020-10-21 06:42 by Barbiani
 
Sasquatch

Senior Member

Joined: 08/05/2020
Location: United States
Posts: 296
Posted: 08:41pm 20 Oct 2020
Copy link to clipboard 
Print this post

I have run everything I can find with no errors.

I did notice a few oddities likely not related to the hashing upgrade:

1. Turtle fill routine seems to be broken again.  I know you had this fixed but at some point must have reverted to old code again.  See this thread for sample code that does not seem to work:

https://www.thebackshed.com/forum/ViewTopic.php?TID=12471&PID=151690#151690#151690


2. Some of the old programs using line graphics seem to be not giving continuous lines?  This may be due to other changes along the way.  I'll post more details if I find anything that can't be fixed by updating to latest commands.
-Carl
 
PeteCotton

Guru

Joined: 13/08/2020
Location: Canada
Posts: 313
Posted: 09:18pm 20 Oct 2020
Copy link to clipboard 
Print this post

  qwerty823 said  Awesome!

I just ran Pete Cotton's Heliblast with this and framerate went from an 10-11 fps to a solid 20.


Can I ask if you have a 400mhz or 480mhz version of the CMM2?

I ask because I was quite worried that heliblaster would be unplayable on a 400mhz. I did consider having an option to have fewer objects on the screen - to keep it playable. This update alone would fix that issue. I can't wait to try it out this evening (also it will significantly help with my next game).
 
qwerty823
Newbie

Joined: 30/07/2020
Location: United States
Posts: 30
Posted: 09:27pm 20 Oct 2020
Copy link to clipboard 
Print this post

  PeteCotton said  
Can I ask if you have a 400mhz or 480mhz version of the CMM2?


I have the 400Mhz pre-assembled board from circuit gizmos.
 
PeteCotton

Guru

Joined: 13/08/2020
Location: Canada
Posts: 313
Posted: 09:31pm 20 Oct 2020
Copy link to clipboard 
Print this post

  qwerty823 said  
  PeteCotton said  
Can I ask if you have a 400mhz or 480mhz version of the CMM2?


I have the 400Mhz pre-assembled board from circuit gizmos.

Thanks. This is excellent news.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8570
Posted: 09:46pm 20 Oct 2020
Copy link to clipboard 
Print this post

  Quote  1. Turtle fill routine seems to be broken again.


Not sure what you mean. Works for me - filled shapes to the right of the centre line as I would expect.

  Quote  Are you using a version control software? Will be there a patch file that adds the hashing?


No and no
Edited 2020-10-21 07:49 by matherp
 
PeteCotton

Guru

Joined: 13/08/2020
Location: Canada
Posts: 313
Posted: 10:00pm 20 Oct 2020
Copy link to clipboard 
Print this post

  qwerty823 said  
  PeteCotton said  
Can I ask if you have a 400mhz or 480mhz version of the CMM2?


I have the 400Mhz pre-assembled board from circuit gizmos.


Wow. I just switch on the FPS counter and did a quick before and after videocapture of the game and .... wow!

Interestingly, I got almost exactly the same frame rates (11ps going up to 20fps with the new firmware) with a 480mhz (as Qwerty823's 400mhz). This is excellent news, as it means that for whatever reason, there doesn't appear to be much difference between the machines, so my worry of developing games that might struggle on other machines is thankfully unfounded.

I have included a video link below. At the 15 second mark it switches from 05.05.06RC3 to the 05.05.06exp firmware... and holy smokes, the game goes insane.

https://youtu.be/dZmtP6rtKFM

I am doing a tonne of maths, lookups and rotations in the code, so somewhere along the line this has almost doubled the speed.

Thank you one again Peter - this is a fantastic and unexpected boost! It's like an early Christmas present.
 
Barbiani
Newbie

Joined: 18/10/2020
Location: Brazil
Posts: 6
Posted: 10:11pm 20 Oct 2020
Copy link to clipboard 
Print this post

Another good boost could come from the blit routines if they are not using the processor facilities. I have seen that the memory functions were using byte access instead of 32bit were possible.
 
Sasquatch

Senior Member

Joined: 08/05/2020
Location: United States
Posts: 296
Posted: 10:11pm 20 Oct 2020
Copy link to clipboard 
Print this post

Something strange going on with filled boxes using Box command.  Seems like borders not drawn or drawn in Black.  I'll try to give more info and some examples when I have more time to investigate.
-Carl
 
MauroXavier
Guru

Joined: 06/03/2016
Location: Brazil
Posts: 303
Posted: 10:18pm 20 Oct 2020
Copy link to clipboard 
Print this post

I´ve tested all my programs and everything is very faster!!

The INTO THE DARKNESS in debug mode was running about 11 FPS and now stays between 16 to 18 FPS!

Gauntlet now reaches easily 30 FPS and can keep 20 FPS with four players with no penalty.

Congratulations, Peter... You this time have surpassed all my expectations. No words can express my admiration for your awesome work.
 
     Page 1 of 8    
Print this page
© JAQ Software 2024