Skip to content

[email protected]: wasm-timer Delay pauses #775

Closed
@azriel91

Description

@azriel91

Heya, e4df140 uses wasm_timer::Delay in src/utils.rs for WASM target's Timer implementation. When running a countdown async task in a loop with a 50 ms delay, it pauses for 4 seconds every 19 iterations (observed in both Chrome and Firefox):

delay_wasm_timer

Switching it to futures_timer::Delay allows it to loop smoothly:

delay_futures_timer

#776 has the change, though futures-timer depends on async-std in [dev-dependencies], so not sure if you'd like the somewhat cyclic reference.

futures-timer backs onto gloo_timers, which calls the browser's setTimeout API. I couldn't figure out how wasm-timer does it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions