Optimization question

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Optimization question
by on (#15949)
Hi

My emulator runs terrible slow so Iam planning to give it a boost but I want to make sure that I don't have to regret my changes. What Iam planning to do is re-format the Pattern Memory and what I want to know is... if Iam changing VRAM Read/Write so it gives correct data can something go wrong when it comes to more perfect emulation/mappers?

thanks

by on (#15951)
Sorry for not answering your specific question, but I highly recommend you first find any available performance profiling tools and use them first. Most development environments have at least one such tool.

by on (#15971)
perhaps you could tell us what seems slow ? what is the cpu usage, what is the cpu ? i would might be simple as chache misses. try turning off your rendering and let the cpu and ppu go. then how fast is it. i was using valgrind and that showed what functions were called the most and where my cache misses were.

matt

by on (#16013)
its an emulator for the Nintendo DS and its really clear that the most time is spent on the PPU looking up each pixel. I'll stick to hardware for a while now cause that gives me 60 fps, Probably I'll never get full speed with software rendering.

by on (#16017)
Quote:
its really clear that the most time is spent on the PPU looking up each pixel


Sounds like there isn't a profiler available for the DS. I forgot to mention that you can still do some basic time profiling if you have a fine-grained timebase; just keep track of the time spent inside a particular function by noting the entry and exit times. Then change which function you're timing using a divide-and-conquer strategy, starting from your main loop.

by on (#16018)
blargg wrote:
I forgot to mention that you can still do some basic time profiling if you have a fine-grained timebase

In fact there is, at least on the GBA and Nintendo DS. There's a cycle timer that can count up to 65536; if you need longer periods, you can use the VCOUNT register to see how many 2130-cycle scanlines have elapsed.

by on (#16702)
What the hell has this got to with NES emulation development?

by on (#16707)
WedNESday wrote:
What the hell has this got to with NES emulation development?

Did you read the thread? He's developing a NES emulator for the Nintendo DS. He needs to optimize the slow parts. Flaming is probably not warranted.

by on (#16710)
Actually, he never refers to it. And my post is not a flame.

by on (#16759)
The digression has been split.