Skip to content
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

Experiment: Making a JavaScript API for handlebars in WebAssembly (WIP) #163

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sunng87
Copy link
Owner

@sunng87 sunng87 commented Jun 24, 2017

This is an experiment for making a JavaScript API for handlebars wasm. The result is expected as similar as original handlebarsjs library.

…script

Signed-off-by: Ning Sun <sunng@about.me>
@sunng87
Copy link
Owner Author

sunng87 commented Jun 24, 2017

I'm using this setup https://medium.com/@ianjsikes/get-started-with-rust-webassembly-and-webpack-58d28e219635 to compile. As of 2017-06-24, Chromium 59.0.3071.109, Firefox 54 and emscripten 1.37.14, I'm getting this error when call my compile function:

Uncaught (in promise) RuntimeError: memory access out of bounds
    at _free (<WASM>[10741]+71)
    at ___rust_deallocate (<WASM>[10589]+11)
    at __ZN5alloc4heap10deallocate17hf3dde7510a423132E (<WASM>[1433]+82)
    at __ZN73__LT_alloc__raw_vec__RawVec_LT_T_GT__u20_as_u20_core__ops__drop__Drop_GT_4drop17ha752346b60305a9dE (<WASM>[1631]+210)
    at __ZN4core3ptr13drop_in_place17h9359bd02a9689a59E (<WASM>[1132]+38)
    at __ZN4core3ptr13drop_in_place17h1a7890a117fe321dE (<WASM>[1086]+140)
    at __ZN4core3ptr13drop_in_place17h01dc571daf330272E (<WASM>[1070]+38)
    at _compile (<WASM>[1817]+1296)
    at Module._compile (http://127.0.0.1:8080/build/bundle.js:19509:83)
    at eval (eval at cwrap (http://127.0.0.1:8080/build/bundle.js:13901:12), <anonymous>:13:28)

@dbousamra
Copy link

Any update on this?

@sunng87
Copy link
Owner Author

sunng87 commented Apr 1, 2021

@dbousamra handlebars now compiles on webassembly. But a JavaScript API is not ready. If you are interested I can offer help for you to hack on it.

@dbousamra
Copy link

@sunng87 thanks for getting back to me.

I came across this project, because we are running into some performance issues with handlebars-js (used within a nodejs backend), and were considering using handlebars-rust, via a JS API, as a stop gap to buy us some more time.

@sunng87
Copy link
Owner Author

sunng87 commented Apr 1, 2021

@dbousamra if you are on nodejs, perhaps handlebars-rust can be loaded as a native dependency, instead of webassembly module. Libraries like neon may help.

@sunng87 sunng87 force-pushed the master branch 2 times, most recently from 7abfce6 to 4962d7e Compare June 4, 2021 16:55
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.

2 participants