You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, if you're using (even transitively) this crate on wasm, it will work fine, until at one point at runtime it panics at the point where one of the dependency uses debug_time! or any of the other *_time! macros, because Instant::now doesn't work in wasm.
panicked at 'time not implemented on this platform', library/std/src/sys/wasm/../unsupported/time.rs:13:9
Because it's a runtime crash, it can be difficult to reproduce and given how hard it is to debug a panic in WASM, it leads to a super frustrating experience.
Disabling these macros in wasm would at least make it a compile error, making it much easier to pinpoint where the problem comes from.
However it would be breaking change, since code that compiles fine today (and maybe crashes at runtime, or maybe not if you're lucky enough not to trigger the right condition) would stop compiling.
The alternative would involve writing a different implementation of MeasureTime for wasm: either by making them do exactly what the “non-time” macros do, or implementing the time measurement in a way that works for WASM (I'm not sure how possible it is in a general way, doing so for the browser is easy but what about non-browser wasm runtimes?)
The text was updated successfully, but these errors were encountered:
I switched in this commit to the instant crate, which is wasm compatible. cd1b207
The config I chose would fallback to performance.now(), which should be available on most runtimes.
I think I can publish this as a bugfix release 0.8.1.
Today, if you're using (even transitively) this crate on wasm, it will work fine, until at one point at runtime it panics at the point where one of the dependency uses
debug_time!
or any of the other*_time!
macros, becauseInstant::now
doesn't work in wasm.Because it's a runtime crash, it can be difficult to reproduce and given how hard it is to debug a panic in WASM, it leads to a super frustrating experience.
Disabling these macros in wasm would at least make it a compile error, making it much easier to pinpoint where the problem comes from.
However it would be breaking change, since code that compiles fine today (and maybe crashes at runtime, or maybe not if you're lucky enough not to trigger the right condition) would stop compiling.
The alternative would involve writing a different implementation of
MeasureTime
for wasm: either by making them do exactly what the “non-time” macros do, or implementing the time measurement in a way that works for WASM (I'm not sure how possible it is in a general way, doing so for the browser is easy but what about non-browser wasm runtimes?)The text was updated successfully, but these errors were encountered: