Best practices for minimizing input latency? #10332
-
My company developed a scientific tool to measure people's response time to stimulus. (Which is a fancy was of saying when a number shows up on the screen and the user taps as soon as they see it and we record how long it took.) Because of the importance of this information, we have a little robot that we use to measure the difference between when the screen was actually pressed versus when it was reported as pressed. In the native opengl version on an ipad pro with 120hz the latency is about 17ms, but in the pixi.js version the latency is ~80ms. More confusingly there's a large variation between latencies in the same run. (as low as 32ms and as high as 100ms) We've upgraded to pixi.js 7 and are using the event.timestamp value to determine when the screen was pressed. Is there anything else we can do to increase the speed or reliability of the input times? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is just how the main thread of the browser works. The only thing you can do is eliminate every possible thing the browser could be doing (including extensions, prefetching, background loads, etc). Low latency input is currently being discussed by the w3c and was the subject of a recent breakouts day (w3c/breakouts-day-2024#2) - although I wouldn't hold your breath for this landing client side for a good while. Wrapping your code into a native app may help eliminate some of the cruft going on that you've no control over. Equally, the very use of Pixi is going to cause delays in the main thread. Would be worth using a very simple plain HTML page, with nothing on it but a bit of JS to trigger the number (as a DOM element, not with Pixi), then record the time, and see what variances you get from that. This is your baseline. Anything beyond this is overhead from WebGL/WebGPU. My guess is it'll still fluctuate like crazy, because main thread. |
Beta Was this translation helpful? Give feedback.
This is just how the main thread of the browser works. The only thing you can do is eliminate every possible thing the browser could be doing (including extensions, prefetching, background loads, etc). Low latency input is currently being discussed by the w3c and was the subject of a recent breakouts day (w3c/breakouts-day-2024#2) - although I wouldn't hold your breath for this landing client side for a good while. Wrapping your code into a native app may help eliminate some of the cruft going on that you've no control over. Equally, the very use of Pixi is going to cause delays in the main thread. Would be worth using a very simple plain HTML page, with nothing on it but a bit of JS to t…