32 ms·
To add to this comment, Stopify is a JS-to-JS compiler that instruments sync JS code to make them interruptible at set points. The paper [0] can explain it bett
by rng_civ 6y ago
To add to this comment, Stopify is a JS-to-JS compiler that instruments sync JS code to make them interruptible at set points. The paper [0] can explain it better than I ever could.
I work on an experimental Pyret [1] runtime that uses Stopify to instrument compiled Pyret code (plain old JS) so that we can run Pyret code on the main page thread without hanging it up. Main thread execution is important for quick/easy DOM access. In terms of performance cost, we haven't measured too extensively, but so far, on average, we're seeing a 2x slow down compared to un-Stopified programs.
(Disclaimer: paid contributor for Pyret).
[0] https://www.stopify.org/research.html https://www.stopify.org/research.html
[1] https://www.pyret.org/ https://www.pyret.org/
- angleofrepose 6y agoDo you see any other solutions in the same domain as Stopify? Another method that might provide a way to keep UI unblocked but still have user executable code?
- rng_civ 6y agoIf you need the user code to execute on the main thread, then unfortunately I am aware of none besides bundling your own tailored system. Pyret used to use its own runtime system [0] but Stopify was created in part to replace it due to the maintenance burden and complexity of "vanilla" JS interoperability. [0] https://www.pyret.org/docs/latest/s_running.html https://www.pyret.org/docs/latest/s_running.html