TimelyDataflow / timely-dataflow

A modular implementation of timely dataflow in Rust
MIT License
3.25k stars 273 forks source link

Replace/augment Instant::now() so Timely could run in the browser #531

Closed sergiyprotsiv closed 4 months ago

sergiyprotsiv commented 1 year ago

Timely and Differential Dataflow can almost be compiled and run using WASM in the browser, at least with the single-threaded worker.

The only bit that prevents this is the use of std::time::Instant::now() which is not available in the wasm32-unknown-unknown target (as there is no access to system clock). In Timely this is only used in connection to logging and could be patched with about 10 changes across the crate.

The simplest solution would be to use the instant crate, which only has one dependence itself and works as std::time::Instant on all platforms other than WASM. An alternative could be to directly qualify the use of instants in Timely itself.

That said, I noticed there was an old issue about time in logging, so maybe my suggestion is not as innocuous as it seems.

sergiyprotsiv commented 4 months ago

This is being addressed as part of https://github.com/TimelyDataflow/differential-dataflow/issues/479.