Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

emulator can run slowly #104

Open
city41 opened this issue Jun 22, 2021 · 2 comments
Open

emulator can run slowly #104

city41 opened this issue Jun 22, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@city41
Copy link
Owner

city41 commented Jun 22, 2021

Some people have recorded videos of smaghetti and in those videos the emulator runs very slow, like 10fps or so. I have also found it runs pretty slowly in Firefox and Safari, even on a very high end machine.

Honestly not sure what can really be done about this. I did some quick profiling and it looks to be death by a million paper cuts. Some specific thumb/arm opcode calls dominate the profile (that is, compared to other opcodes, they don't dominate the entire profile), so possibly for those specific instructions, removing the closure and generating a function each time might help.

Barring that, switching to a web assembly based emulator might be needed.

@city41 city41 added enhancement New feature or request help wanted Extra attention is needed labels Jun 22, 2021
@city41
Copy link
Owner Author

city41 commented Jun 22, 2021

actually calls related to updating the canvas, pushPixel, renderScanline and finishScanline make up a large chunk of the profile too, and they might have some optimization opportunities.

@city41
Copy link
Owner Author

city41 commented Jun 22, 2021

another possibility, is the emulator spending a lot of time checking for things that sma4 never uses? would it be possible to pair the emulator down to just what is needed for sma4? seems like a long shot and a ton of work, but really learning gba internals and how gba.js works would probably be beneficial in general.

@city41 city41 removed the help wanted Extra attention is needed label Feb 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant