Hey GiNaC people! First of all, thank you for this great library! I'm working on a web-based interface for GiNaC as a hobby project and I wanted to share it with you. You can try a demo frontend here: https://daninet.github.io/ginac-wasm/ Source code: https://github.com/Daninet/ginac-wasm There is no operator overloading in JavaScript, so I had to implement functions like add(), mul() for the different operations. The GiNaC commands are batched for faster processing because WASM <=> JavaScript calls are too expensive. The demo frontend includes a PEG-based parser written in JavaScript, but the embedded parser is also exposed through the parse() function. At this moment, the JavaScript/TypeScript API looks like this: const GiNaC = await initGiNaC('./dist/ginac.wasm'); const g = getFactory(); GiNaC(g.mul(g.numeric('2'), g.pow(g.symbol('x'), g.numeric('2')))); GiNaC(g.series(g.atan(g.symbol('x')), g.symbol('x'), g.numeric('5'))); On my computer, the native ginsh is about 10x faster in estimating Pi with Machin’s formula compared to my WebAssembly port. That's because of the expensive C++ exception mocks generated by Emscripten, which compensate for the lack of native browser support for exceptions in WebAssembly. I estimate that the performance gap can be brought down to about 1/2 of native performance once the native exception instructions are getting wildly available in browsers. I plan to publish it on NPM (the JavaScript package library) when I manage to stabilize the API and implement the remaining features. What do you think? Do you have any suggestions or ideas? Best regards, Dani Biró
Dear Dani, It seems to in an interesting work. GiNaC-on-Web may be accessible on some common platform, which would be difficult or impossible support otherwise. I think it can be useful! Best wishes to you and your project, Vladimir -- Vladimir V. Kisil http://www.maths.leeds.ac.uk/~kisilv/ Book: Geometry of Mobius Maps https://doi.org/10.1142/p835 Soft: Geometry of cycles http://moebinv.sourceforge.net/ Jupyter notebooks: https://github.com/vvkisil/MoebInv-notebooks
On Tue, 2 Nov 2021 21:57:21 +0200, Dani Biró <danipro93@gmail.com> said:
DB> Hey GiNaC people! DB> First of all, thank you for this great library! DB> I'm working on a web-based interface for GiNaC as a hobby DB> project and I wanted to share it with you. DB> You can try a demo frontend here: DB> https://daninet.github.io/ginac-wasm/ Source code: DB> https://github.com/Daninet/ginac-wasm DB> There is no operator overloading in JavaScript, so I had to DB> implement functions like add(), mul() for the different DB> operations. The GiNaC commands are batched for faster processing DB> because WASM <=> JavaScript calls are too expensive. The demo DB> frontend includes a PEG-based parser written in JavaScript, but DB> the embedded parser is also exposed through the parse() DB> function. DB> At this moment, the JavaScript/TypeScript API looks like this: DB> const GiNaC = await initGiNaC('./dist/ginac.wasm'); const g = DB> getFactory(); GiNaC(g.mul(g.numeric('2'), g.pow(g.symbol('x'), DB> g.numeric('2')))); GiNaC(g.series(g.atan(g.symbol('x')), DB> g.symbol('x'), g.numeric('5'))); DB> On my computer, the native ginsh is about 10x faster in DB> estimating Pi with Machin’s formula compared to my WebAssembly DB> port. That's because of the expensive C++ exception mocks DB> generated by Emscripten, which compensate for the lack of native DB> browser support for exceptions in WebAssembly. I estimate that DB> the performance gap can be brought down to about 1/2 of native DB> performance once the native exception instructions are getting DB> wildly available in browsers. DB> I plan to publish it on NPM (the JavaScript package library) DB> when I manage to stabilize the API and implement the remaining DB> features. DB> What do you think? Do you have any suggestions or ideas? DB> Best regards, Dani Biró
participants (2)
-
Dani Biró
-
Vladimir V. Kisil