-
Notifications
You must be signed in to change notification settings - Fork 22
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 compiler and runtime support for generating pure JS as an alternative to C/Wasm #437
Comments
SummaryI'll be filing a PR for this work shortly, and will be merging it to the This branch focuses on the compiler, cli, and runtime changes that allow for generation of a plain JavaScript model. There are some changes to the APIs and Changing to JS as the default code gen strategy (instead of C/WebAssembly)One goal with this work is to make the JS target be the default behavior, since it requires no additional dependencies to build a working model. All you need is your existing Node.js installation, so this will make it easier for new users to get started with SDEverywhere. This is in contrast to building Wasm, which requires Emscripten (which requires Python to install); this has been a pain point for users who are new to SDEverywhere. Generating Wasm is still relatively easy to get set up using the Simplified initializationI've made a number of improvements and simplifications to the generated models and to the runtime APIs that make it easier to initialize a model, regardless of whether it is in JS or Wasm format. These diffs illustrate how the initialization process has been simplified, and the same code works if Changes to
|
Since we have refactored the parse and code gen phases, it is now more feasible to add support for generating JS as an output format. A few considerations:
The benefit of generating JS is that it can reduce the complexity of getting started with SDE, since the user doesn't need to worry about getting Emscripten set up or working with multiple plugins (wasm and worker plugins, for example).
It can also open new doors for rapid prototyping with SDE: we can potentially build a REPL-like environment for learning SD modeling entirely in the browser, no local toolchain required.
Pure JS code won't likely run as fast as the existing Wasm-via-C code, but when working with smaller models, JS should provide sufficient performance.
The text was updated successfully, but these errors were encountered: