[英]Microsecond or at least sub-millisecond timing in a web-worker?
There are libraries for high precision timers in node.js
and there is the window.performance.now()
for the main thread https://stackoverflow.com/a/21120901/1056563 . node.js
有高精度计时器库,主线程有window.performance.now()
https://stackoverflow.com/a/21120901/1056563 。 Is there anything for web-workers (which do not have access to window
or the DOM
)?网络工作者(无权访问
window
或DOM
)有什么东西吗?
There's a performance
property on WorkerGlobalScope
. WorkerGlobalScope
上有一个performance
属性。 It's not super-widely supported, but then again neither are web workers.它没有得到超级广泛的支持,但同样也不是网络工作者。
Specifically, .now()
is (apparently) available to web workers, if that's all you need.具体来说,
.now()
(显然)可供网络工作者使用,如果这就是您所需要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.