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 4 of 8 | |||||
Author | Message | ||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3865 |
Much to my chagrin "yes". Then again, perhaps it is best for a developer to be running the lowest common denominator. Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3678 |
I don't see why it would even look for a global until it has first looked for a local. Only if there's no local (in the current SUB/FUNC) would it then look for a global. John |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3865 |
Except, at least in the model I've built up from what Peter has said previously in this thread and others, there is only one table containing the global and local variables and a traversal of that table under either scheme will almost always find the global definition first ... unless you did a linear search backwards, and even then it isn't guaranteed because a function/sub can create a global variable. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3865 |
... I think the way I would have done it would have been to store the local variables separately on a stack. Then when a lookup occurs first search down the stack until you reach the frame pointer (probably only a half dozen elements at most) and then switch to searching the global variables table. That would also make cleanup of local variables faster. However I assume there are good reasons for not doing it this way. Another alternative (BBC Micro) is that when a local variable is declared the global variable that it shadows is transferred to the stack and the local variable takes its place in the main variables table. This makes lookup more efficient but declaration of locals and restoration of the main variables table on return more expensive. Again this is only intellectual discussion not a request for a change to the implementation ... maybe I should put this in my signature Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
MauroXavier Guru Joined: 06/03/2016 Location: BrazilPosts: 303 |
I would love to have a CMM2 running at 480Mhz too, but simultaneously I'm thinking in other users with 400Mhz playing my games. I thinking a long time about the differences in the CPU speed, and this can occur in the future in a more aggressive way (imagine a CMM2 or CMM3 at 1Ghz). I'm testing and trying to change the way my games are processed. Currently, all my programs use a frame limiter concept only, but if the demand for CPU is too higher the game will slow down and in some cases, this can be annoying for the gameplay. In INTO THE DARKNESS I've implemented for the first time the frame time concept, and I will try to spread this to all my other programs, as with this implementation the speed always be the same making the pixel stepping go higher as per the demand on the CPU instead of slow down all the game. Maybe in GAUNTLET, this doesn't work so well in some situations because in some type of games the slowdown is preferable because of the selected collision algorithm, but in the 3D games, the difference in gameplay is very positive using frame time instead of an unstable speed. This outstanding firmware upgrade made it possible to test all this concept and now I'm very satisfied with the result. PS.: Sorry, I know I was a little off-topic. Edited 2020-10-22 22:39 by MauroXavier |
||||
PeteCotton Guru Joined: 13/08/2020 Location: CanadaPosts: 316 |
Grumble away my friend. I have no idea why, but there seems to be little difference between the 400mhz and 480mhz when running Heli-Blaster. It must be getting bound up on something not related to raw clock cycles. But I think you are correct. There is no harm, as a developer, having the lowest common denominator. Back in the day, I upgraded my Amiga 500 to a 1200. (7mhz 68000 to 14mhz 68020). It was a bit of a waste of money as hardly any programs actually made use of the extra power (given that 90% of the user base where 500's), and because it was bound by disk access speeds etc. it didn't really feel twice as fast. Great work on optimising the Z-Machine for the CMM2 by the way. Next up Magnetic Scrolls? See Strand Games. https://gitlab.com/strandgames/brahman/-/tree/master/zxnext_magnetic/games/pawn Edited 2020-10-23 01:52 by PeteCotton |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3865 |
Thanks it was fun, though it seems to have subsequently garnered little interest. I imagine the Magnetic Scrolls games 'terp is no more computationally intensive than the Z-machine, it's just prettier, so it's probably possible on the CMM2. That said, I think I've done my bit with Text Adventures. My next project, assuming I ever escape the clutches of the Welcome Tape, is an implementation of Core War ... which I imagine will be equally ignored by the denizens Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
PeteCotton Guru Joined: 13/08/2020 Location: CanadaPosts: 316 |
My next project, assuming I ever escape the clutches of the Welcome Tape, is an implementation of Core War ... which I imagine will be equally ignored by the denizens Tom Nice. I've never played/programmed it, but I've been aware of it since the 90's. It's a neat concept. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8605 |
|
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3865 |
Very nice, but did you optimise the firmware? ... or have you just spent the last 24 hours hand optimising my code? ... please don't tell me it's the latter. Tom Edited 2020-10-24 02:00 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8605 |
Haven't touched your code - just improved the hashing |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3865 |
In that case we are truly not worthy to be blessed by your greatness Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8605 |
Please try the attached on as many programs as possible: CMM2V1.5.zip The OPTION NOHASH has been removed as it is no longer necessary The variable table has been partitioned between global variables and local and a maximum of 512 of each are now allowed. The current list of local variables is now maintained on a LIFO stack which greatly improves performance removing them when the subroutine ends whilst still allowing instant access through the hash key. For many programs this version will be even faster than the first experimental release. Notes for the manual: ERASE only works on global variables. CLEAR can only be executed from the main program. For best performance one tip: Try to avoid duplicate variable names between nested subroutines e.g. sub fred local integer i,j bert i end sub ' sub bert i local integer j j=i end sub By definition this will create hash collisions which require additional processing to resolve. Note to Mauro: This version (and to some extent the previous) is completely rigorous in losing all context after a CLEAR command. Version 5.05.05 and previous seemed to allow you to get away with some strange things after a clear command. As before the TLS demo in DemoX is giving me a problem. I don't think I have a firmware code error as everything else I have tried works but there may be (it is also possible I've just b...d the Basic code). Please explore this and let me know. |
||||
Barbiani Newbie Joined: 18/10/2020 Location: BrazilPosts: 6 |
This is a great improvement. Too bad it does not share code with the older mites. Edited 2020-10-24 03:28 by Barbiani |
||||
MauroXavier Guru Joined: 06/03/2016 Location: BrazilPosts: 303 |
This version (and to some extent the previous) is completely rigorous in losing all context after a CLEAR command. Version 5.05.05 and previous seemed to allow you to get away with some strange things after a clear command. As before the TLS demo in DemoX is giving me a problem. I don't think I have a firmware code error as everything else I have tried works but there may be (it is also possible I've just b...d the Basic code). Please explore this and let me know. Ok! I will gladly fix the DEMOX to run in this version. Yesterday I was testing each part of the demo and adjusted to use this speed gain to put more visual effects and to make some parts more smooth. The difference is so positively aggressive that maybe I will call it DEMOX+... I must upload in GitHub this version of DEMOX when this firmware became gold, as I will put a firmware version check because the demo will run correctly only in this version or above. Edited 2020-10-24 03:51 by MauroXavier |
||||
elk1984 Senior Member Joined: 11/07/2020 Location: United KingdomPosts: 227 |
Much to my chagrin "yes". Then again, perhaps it is best for a developer to be running the lowest common denominator. Tom Is there a way of telling which I have from a query (rather than opening the case ) |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8605 |
Look at the last line on the screenshot I posted |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3865 |
So far so good, and the spurious "Local variable already declared" error with "spflow" is gone too. Will try to test the contents of the latest version of the "Welcome Tape" over the weekend. Best wishes, Tom Edited 2020-10-24 06:03 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
elk1984 Senior Member Joined: 11/07/2020 Location: United KingdomPosts: 227 |
Look at the last line on the screenshot I posted Doh! |
||||
elk1984 Senior Member Joined: 11/07/2020 Location: United KingdomPosts: 227 |
Look at the last line on the screenshot I posted |
||||
Page 4 of 8 |
Print this page |