Ive been programming an emulator as a side project and am at a point now where I am tackling efficiency. Ive managed to get rid of all the slow things that I was doing like lots of SDL_RenderDrawPoint's, but now I'm stuck.
Ive managed to narrow it down to SDL_PollEvent. Ive simplified my main loop and event loop so that they look similar to a simple SDL tutorial. When I comment out the event loop, the emulator runs super fast. Ive also used the visual studio performance profiler to check, and sure enough, SDL_PollEvent is taking up ~94% of the cpu time.
The place where my emulator does all its stuff is in ppuNptr->cycle() which is taking up only 1.48% .
Unfortunately I can't replicate this in another project so I'm at a loss.
Is there something that I should be doing before polling for events?
How else could I debug this?
Currently im on windows 10 with visual studio 2019 and sdl 2.0.10 .

SDL_PollEventwon't be the ones you check for, which means the loop will iterate a lot and callSDL_PollEventquite a lot. - Some programmer dude