Skip to content

Conversation

georgestagg
Copy link
Member

@georgestagg georgestagg commented Jul 13, 2024

Improvements to R's bytecode interpreter (TCO, more efficient use of stack space - thanks Luke!) mean it's now feasible to run it under Wasm by default. The R Wasm binary still grows a lot when the interpreter is included (by about 2MB!), but the reduction in complexity of our changes to R and potentially better runtime performance should make it worth it.

In particular, this might allow Shiny to run under Wasm without requiring hacks to reduce the size of the call stack.

Some things to be done before this can be merged:

The bytecode interpreter was re-enabled in 88cc9ef. We should still check the following before closing this PR.

  • Run some benchmarks, get some real numbers on performance impact.
  • Compare maximum depth with & without bytecode, e.g. rec <- function(n){print(n); n * rec(n+1)}; rec(0)
  • Confirm loading non-byte-compiled Wasm R packages still works OK with this PR.
  • Confirm loading byte-compiled Wasm packages works OK in previous releases of webR.
  • Update {rwasm} to start byte-compiling R packages during cross-compilation.
  • (Optional) Refresh https://repo.r-wasm.org for byte-compiled packages.
  • Test byte-compiled Shiny under Wasm.

@georgestagg georgestagg marked this pull request as draft January 22, 2025 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant