3 ms·
> Timestamp queries allow WebGPU applications to measure precisely (down to the nanosecond) how much time their GPU commands take to execute compute and render
by rezonant 3y ago
> Timestamp queries allow WebGPU applications to measure precisely (down to the nanosecond) how much time their GPU commands take to execute compute and render passes
> ...
> Due to timing attack concerns, timestamp queries are quantized with a resolution of 100 microseconds, which provides a good compromise between precision and security.
I don't have a particular need of nanosecond granularity timestamps for WebGPU- there are other parts of the web stack where I could really use better time measurement- but I understand the security concern and it's far better to be safe than sorry.
But they quote two wildly different granularities in the same article, within a paragraph of each other...
- jsheard 3y agoThe former is a spec detail (the result is returned in ns) and the latter is an implementation detail (browsers currently quantize the result to 100us). That is a useful distinction since you can use WebGPU outside of the browser by embedding Dawn or wgpu into your own application, and there you should get the maximum resolution the spec allows for. Environments like Electron might also opt-out of that timing attack mitigation since they're intended to run trusted code. I agree the article could have made that clearer though.
- eyegor 3y agoMeanwhile sleep() in js land is more of a suggestion when it comes to accuracy. Browser standards are strange. Of course I mean setTimeout/interval because js doesn't even expose a sleep function.
- deleted 3y ago[deleted]