-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add WebAssembly interface option #11
Add WebAssembly interface option #11
Conversation
As suggested by @tmm1 to improve compatibility with js
91c29c3
to
4a22d66
Compare
Thanks for this @thomascwells and @tmm1, being able to do calculations locally is a huge plus! I tested everything on my laptops and it seems great. I even rebuilt the pkgdown site using the 'wasm' option and all output seemed to work fine. I also sent it to win-builder using I have a couple of question prior to merging and re-sending to CRAN:
Also, once I merge I will update the documentation on the pkgdown site then resend to CRAN unless you think there will be more changes / additions in the short-term. But, I would like to get the wasm functionality on CRAN sooner rather than later. |
I think making wasm default is sensible. There are no caveats that I am aware of. A possible advantage of ssh/http is that Dan can update those on-demand, whereas changes to wasm will require updating the vendored files and making a new release. As far as http, I think it's worth keeping around. It's unclear why it's limited at the moment, but I plan to investigate further and hopefully it can be resolved quickly. There may be systems/platforms where v8 doesn't work and ssh is unavailable. |
Maybe hold off for a day or two. Dan said he was going to work on possibly generating a version of the Fortran code that could be called directly from R (e.g. using the
I also think that's possible. It's unlikely, but good enough reason to keep the http option around for now. Can always deprecate it later if needed.
I also see that as a possible advantage of wasm - it's more reproducible. Rewind to a previous version of the package and you will get whatever results were being produced at the time. Easier to revert if bugs are ever introduced, etc. I do like the idea of having "latest and greatest" always available on the web, but I also really like reproducibility. |
I was not planning on resubmitting to CRAN until this weekend, so a few days should not be an issue. I will merge and make wasm the default. I will also also add an error or at a minimum warning about using http with large data sets. Of course, I will double double check the issue right before resubmitting to see if it has been resolved. Finally, I will get all the documentation updated and in good shape. Thanks again! |
This PR adds an additional interface option that uses fortran code compiled into WebAssembly (
.wasm
) with a JavaScript (.js
) interface. The wasm and js files are loaded using theV8
package, based on Chrome'sV8
engine.The wasm and js files were generated by @tmm1 in the repo tmm1/taxsim.js. These are also available on the NBER website demo, however the files available on github may represent more current versions.
The
wasm
interface is roughly 3x faster thanssh
on my laptop (tested with input data of 5k and 50k rows). Thehtml
interface fails for input data of more than ~1000 rows.