4 ms·
This doesn't have anything to do with React, it has to do with refresh rate, vertical sync, and the fact that your cursor position is updated by hardware and do
by andrewmcwatters 4y ago
This doesn't have anything to do with React, it has to do with refresh rate, vertical sync, and the fact that your cursor position is updated by hardware and doesn't undergo the same update process as the rest of UI compositing in an operating system.
Draw a software cursor, and the same exact thing happens.
In fact, in effect, the red dot is a software cursor.
You can accomplish visualizing the same lag in a traditional update-draw loop in game software.
Cursors are special. Sibling comments here don't experience the same effect, because they're running displays at higher refresh rates.
That's it.
- megous 4y agoHm, right. Good to be corrected. Not sure why the lag is so big, though. Looks like it's 3 frames looking at slowmo capture of the screen. I guess you can take your cursor position at the beginning of scanout of the previous frame, render the new browser layer content, tell the compositor to update both cursor layer position, and browser layer at the next scanout, and both should have matching positions on the next frame. Maybe if the compositor is updating the cursor layer position from mouse position known right at the momen of atomic commit, there may be some difference. Well, this is Xorg I'm using, and it's not using atomic DRM API, so things are not well synchronized.