-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: minimal swipl-web
#4
Comments
I believe this depends on emscripten-core/emscripten#5828. It would likely make cross-environment usage also easier. "Want emulated filesystem? Just import @something/emulated_filesystem and mount to the Module". Regarding loadable code size, it's dominated by .wasm and .data (Prolog), so the gain might not be that good:
There is also WASI-SDK which has own libc, uses similar compiler setup with clang as Emscripten but does not build any sort of JS at all. libc (also posix?) emulation is done inside wasm binary, not outside: https://github.com/WebAssembly/wasi-sdk. Might be worth to investigate. |
Code size regarding C/wasm is also discussed in https://swi-prolog.discourse.group/t/wiki-discussion-swi-prolog-in-the-browser-using-wasm/5651/109 We definitely want to distribute the full build with as much included as possible but also the/a minimal build? For the minimal build:
The NPM package can contain things side-by-side in dist subdirectories. It would not be too difficult to make the Docker-based build produce binaries in different weight classes. Anyone needing something really minimal could always build their own too. |
I also noticed that swipl-web.js contains references to modules |
It might also be worthwhile investigating the use of the closure compiler to reduce the size of the emitted JS. I did quickly try it but it looks like some fixes are required on pre-js and post-js first.
|
Seems like code is already minified. I'm not sure how much closure compiler could reduce it further. It would still be nice to fix to errors. Seems like closure compiler wants to interpret jsdoc very strictly. Maybe the check can be turned off or those jsdoc nodes moved to constructors or otherwise fixed. Error in Variable |
This might be a more appropriate issue to open in https://github.com/SWI-Prolog/swipl-devel/ down the line; but I think it is fine to keep it here for now as I don't expect this will be a priority for anyone anytime soon.
It would be nice to have a much smaller build of
swipl-web
that does not make use of thepath
,fs
andcrypto
modules; and also does not do any fetch handling internally.This means that use cases with apps that just want to run basic queries don't need to import unecessary code into their apps.
I'm analyse tree-shaking downstream can offer for this particular file; which could well make this a moot point to solve anyway.
The text was updated successfully, but these errors were encountered: