Live data from Hacker News

Cheerp 1.2 – C++ to JavaScript: faster than Emscripten with dynamic memory

blog.leaningtech.com

21–23 of 23 posts

Re: Cheerp 1.2 – C++ to JavaScript: faster than Emscripten with dynamic memory

#21

Question: can js call out to native libraries as well ? I'm wondering why BLAS/LAPACK is not callable from JS. there are all these questions about how to use LAPACK from js.. and none seem to work right. [1] http://stackoverflow.com/questions/21990243/use-emscripten-w... [2] https://github.com/software-engineering-amsterdam/MLitB/issu... [3] https://github.com/karpathy/convnetjs

If it needs to run in the browser you'll have to compile the libraries to JS so that all code runs in the security sandbox. With node.js, it is possible to directly call out into native code. Google has a native messaging feature which allows it to communicate with native applications but these need to have been installed traditionally.

well nobody has been successful at calling out to BLAS/LAPACK from nodejs. I wonder why. is there a certain signature that the functions must expose or something ?

Re: Cheerp 1.2 – C++ to JavaScript: faster than Emscripten with dynamic memory

#22

Earlier quoted context omitted.

If it needs to run in the browser you'll have to compile the libraries to JS so that all code runs in the security sandbox. With node.js, it is possible to directly call out into native code. Google has a native messaging feature which allows it to communicate with native applications but these need to have been installed traditionally.

well nobody has been successful at calling out to BLAS/LAPACK from nodejs. I wonder why. is there a certain signature that the functions must expose or something ?

I don't know unfortunately. Here's an old discussion on the emscripten discussion group, may be this contains helpful information: https://groups.google.com/forum/#!searchin/emscripten-discus...

Re: Cheerp 1.2 – C++ to JavaScript: faster than Emscripten with dynamic memory

#23
post #14

There are three relevant memory modes for Emscripten to compare with here, 1. Normal output, asm.js, no memory growth. Maximal speed, fixed memory size. 2. Memory growth. As the article mentions, asm.js no longer supports this, but Emscripten does. It just removes the 'use asm'. 3. Split memory. As the article mentions, this is non-asm.js. This supports not just growing and shrinking memory, but allocating each chunk…

Some additional data about Emscripten code without asm.js mode, corresponding to memory model 2 in your comment. We generated the data on spidermonkey using the --no-asmjs command line switch.

Startup time: https://docs.google.com/spreadsheets/d/17fFM1YqhMV2-O0ZdymEv...

Execution time (small benchmarks): https://docs.google.com/spreadsheets/d/17fFM1YqhMV2-O0ZdymEv...

Execution time (larger benchmarks): https://docs.google.com/spreadsheets/d/17fFM1YqhMV2-O0ZdymEv...

Post reply on HN