fredreload Posted March 1, 2021 Posted March 1, 2021 So take a look at the video below. The idea is when you run a retro game in modern CPU you can run it in turbo speed. With such a mechanism applied to an emulator, I want to run Python program in turbo speed. I know it might not be possible with Python because of its vast libraries, but perhaps I can gear up an exe executable with this method?
Ghideon Posted March 1, 2021 Posted March 1, 2021 (edited) 54 minutes ago, fredreload said: So take a look at the video below. The idea is when you run a retro game in modern CPU you can run it in turbo speed. With such a mechanism applied to an emulator, I want to run Python program in turbo speed. I know it might not be possible with Python because of its vast libraries, but perhaps I can gear up an exe executable with this method? Can you explain what you are looking for in a way that does not require videos to be watched? But it sounds like the comparison is backwards: the question would be how slow your current python code would run on the old gaming hardware. The fact that an old game can run faster on new hardware than the game was able to (or designed to) run on old hardware does not in general mean any code can run faster. (I assume you want some Python program to execute faster without changing the program or changing the hardware and that the Python program currently utilize the hardware to max; your question it's not simply an issue of allocating more of the existing CPU power to the Python program.) Edited March 1, 2021 by Ghideon
Sensei Posted March 1, 2021 Posted March 1, 2021 (edited) 1 hour ago, fredreload said: So take a look at the video below. The idea is when you run a retro game in modern CPU you can run it in turbo speed. With such a mechanism applied to an emulator, I want to run Python program in turbo speed. I know it might not be possible with Python because of its vast libraries, but perhaps I can gear up an exe executable with this method? You don't seem to understand what he did on the video... Game was not run in some turbo speed. Just frequency of key events was increased.. On Windows OS is sending events WM_KEYDOWN when user pressed key and WM_KEYUP after releasing key button. However when user pressed key button and holds it, there are send WM_CHAR with small delay between them. Application (emulator) and/or external keyboard utility (e.g. keylogger) can inject more WM_CHAR into input events queue and increase frequency. Buggy application will be cheated because programmer did not think about such situation in advance.. Similar situation is with games which did not wait for vertical blank (VBlank interrupt). Emulator get this functionality to fight with such not waiting for vblank games, so they still could be usable after increasing delay of key events. If you want to increase speed of execution of your programs 1) stop using Python and write code in C/C++ 2) use multithreading. Modern CPUs have 8+ HT threads and more. 3) use CUDA/OpenCL and use GPU for heavy computing. Modern GPUs have 1024-8192 cores on GFX. 47 minutes ago, Ghideon said: (I assume you want some Python program to execute faster without changing the program or changing the hardware and that the Python program currently utilize the hardware to max; your question it's not simply an issue of allocating more of the existing CPU power to the Python program.) Looking on questions asked on the forum, doubtful that his Python programs are multithreaded. So he could instantly have 8-12 boost after using the all cores of CPU.. If script is just calculating.. But the most of the scripts are loading data from storage etc. etc. Getting M2 NVMe would speedup 3-7x in comparison to ordinary SSD, and 70x in comparison to traditional HDD. Edited March 1, 2021 by Sensei
fredreload Posted March 1, 2021 Author Posted March 1, 2021 57 minutes ago, Sensei said: You don't seem to understand what he did on the video... Game was not run in some turbo speed. Just frequency of key events was increased.. On Windows OS is sending events WM_KEYDOWN when user pressed key and WM_KEYUP after releasing key button. However when user pressed key button and holds it, there are send WM_CHAR with small delay between them. Application (emulator) and/or external keyboard utility (e.g. keylogger) can inject more WM_CHAR into input events queue and increase frequency. Buggy application will be cheated because programmer did not think about such situation in advance.. Similar situation is with games which did not wait for vertical blank (VBlank interrupt). Emulator get this functionality to fight with such not waiting for vblank games, so they still could be usable after increasing delay of key events. If you want to increase speed of execution of your programs 1) stop using Python and write code in C/C++ 2) use multithreading. Modern CPUs have 8+ HT threads and more. 3) use CUDA/OpenCL and use GPU for heavy computing. Modern GPUs have 1024-8192 cores on GFX. Looking on questions asked on the forum, doubtful that his Python programs are multithreaded. So he could instantly have 8-12 boost after using the all cores of CPU.. If script is just calculating.. But the most of the scripts are loading data from storage etc. etc. Getting M2 NVMe would speedup 3-7x in comparison to ordinary SSD, and 70x in comparison to traditional HDD. I looked at the emulator's source code. I think they are skipping frames so instead of 60 frames per sec they stream at 120 frames per sec. I would only guess the whole mechanics works like a CRT television screen display.
Sensei Posted March 2, 2021 Posted March 2, 2021 9 hours ago, fredreload said: I looked at the emulator's source code. I think they are skipping frames so instead of 60 frames per sec they stream at 120 frames per sec. I don't think so. It would boost opponents movements as well as the main player movements, possibly rendering entire game unable to play anymore by human. Quote I would only guess the whole mechanics works like a CRT television screen display. The all real time games refresh at constant rate (if game has wait for vblank) or adaptive rate (if has not wait for vblank). Contrary to games with rounds in which objects don't move therefore don't require periodical screen refreshes. Refresh is needed when there is movement to update state. There are special electronic displays which update only when there is change of pixels. Used mostly with ebooks. This reduces electric power usage only to switch states and saves battery.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now