[gambit-list] Gambit universal library in the browser

Marc Feeley feeley at iro.umontreal.ca
Wed Mar 25 07:25:36 EDT 2020

> On Mar 25, 2020, at 5:47 AM, Duy Nguyen <pclouds at gmail.com> wrote:
> On Wed, Mar 25, 2020 at 9:49 AM Marc Feeley <feeley at iro.umontreal.ca> wrote:
>> With the latest commit the Gambit universal library can be used in the browser… it is as simple as:
>> % make _gambit.js
>> % gsc/gsc -:= -target js -exe -o webapp.js webapp.scm
>> % open webapp.html
> I just had to try, this is so cool. And gladly report back it worked
> as expected.
> A smarter linker next? A 31MB js file seems too much, even for a real
> application, not just "hello world".
>> Duy

Yes the smart linker will definitely be useful here.  It is an important milestone on my TODO as it will help all of the backends and integrate with the module system.

Although 31 MB is quite big, it is still usable for local development.  The compilation and linking with gsc for the small example takes 1/10 of a second and the browser starts the app from the local file in a fraction of a second, so the development loop is quite pleasant.

For use on the web the generated JavaScript code could be compressed with various methods.  Marc-André Bélanger has experimented with a code compressor (post-processing of the .js code) that reduces the size by a factor of 3.  And when gzip compression is also enabled in the web server the final network transfer is about 5% of the original size.  So this would represent a decent 1.5 MB network transfer *without* the smart linker.

If you are interested in working on minimizing the generated JavaScript code please let me know and I can guide you through the relevant parts of the universal backend.


More information about the Gambit-list mailing list