简体   繁体   中英

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 . Is there anything for web-workers (which do not have access to window or the DOM )?

There's a performance property on WorkerGlobalScope . 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM