bblfsh / web

Web client for Babelfish server
http://dashboard.bblf.sh
GNU General Public License v3.0
23 stars 21 forks source link

Investigation: compile libuast to js and use it on client instead of server side libuast #120

Open smacker opened 6 years ago

smacker commented 6 years ago

Currently, for x-path filtering we use libuast on server side. For every filter request we send all source code to the server, reparse it using bblfsh then applying filtering on server side.

Looks like we can skip most of this steps and simplify code if we would be able to compile libuast to js.

If it's possible, together with https://github.com/bblfsh/dashboard/issues/118 we will be able to remove backend almost completely.

bzz commented 6 years ago

Used ecmascripten to cross-compile both, libxml2 and libuast to JS/wasm on one of the OSDs, for the purpose of running it on BigQuery. Examples work after cross-compilation with browser and node for me, but resulting binary is few Mbs so not possible to fit 1mb BigQuery external UDF limit.

Did not peruse it any further, but would be happy to share if somebody what's to apply it in dashboard.

smacker commented 6 years ago

Example of using cross compiled libuast is here: https://github.com/smacker/in-browser-uast

there is an example which is a simplified version of the dashboard.

The current size of wasm+js is ~750kb.

smacker commented 6 years ago

implemented here: https://github.com/smacker/dashboard/tree/bblfsh_js

dennwc commented 6 years ago

Any plans to integrate it?