Spikeystuffy told me I should have a look at level 1 at least. Altought I didn't improve anything I found that the game sometimes stops movement for 1 pixel. I don't know why this happens, but I think it has to do with enemies on screen (fake lag, not visible with red lag frames).
I wrote a small script to spot the lag frames:
Download q boy lag.luaLanguage: lua
while (true) do
X_old = X
X = memory.readbyte(0x0088) + memory.readbyte(0x0002);
if X == X_old
then FCEU.pause();
end
FCEU.frameadvance();
end
When you entered a level pause the movie playback, start the script and then resume the movie playback. The movie will automatically pause, when it detects a fake lag.
Memory addresses are:
0x0088: X On Screen
0x0002: X Camera
0x0089: Y Position
Maybe there are frames to save by avoiding the fake lag.