From feeley@iro.umontreal.ca Tue Mar 24 22:49:45 2020 From: Marc Feeley To: gambit-list@iro.umontreal.ca Subject: [gambit-list] Gambit universal library in the browser Date: Tue, 24 Mar 2020 22:49:38 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7467253794938835154==" --===============7467253794938835154== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable With the latest commit the Gambit universal library can be used in the browse= r=E2=80=A6 it is as simple as: % make _gambit.js % gsc/gsc -:=3D -target js -exe -o webapp.js webapp.scm % open webapp.html webapp.scm: (declare (extended-bindings)) (define (document.write html) (##inline-host-statement "document.write(g_scm2host(@1@));" html)) (document.write "

Hello world!

") webapp.html: webapp --===============7467253794938835154==-- From lassi@lassi.io Wed Mar 25 04:22:32 2020 From: Lassi Kortela To: gambit-list@iro.umontreal.ca Subject: Re: [gambit-list] Gambit universal library in the browser Date: Wed, 25 Mar 2020 10:22:26 +0200 Message-ID: <25bb5e38-e540-30e1-993a-12ed9422e0c1@lassi.io> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4335838386633560118==" --===============4335838386633560118== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Thank you very much for putting the finishing touches on JavaScript! Looking forward to using it. --===============4335838386633560118==-- From pclouds@gmail.com Wed Mar 25 05:47:52 2020 From: Duy Nguyen To: gambit-list@iro.umontreal.ca Subject: Re: [gambit-list] Gambit universal library in the browser Date: Wed, 25 Mar 2020 16:47:22 +0700 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4199858701416746089==" --===============4199858701416746089== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 25, 2020 at 9:49 AM Marc Feeley wrote: > > With the latest commit the Gambit universal library can be used in the brow= ser=E2=80=A6 it is as simple as: > > % make _gambit.js > % gsc/gsc -:=3D -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". --=20 Duy --===============4199858701416746089==-- From feeley@iro.umontreal.ca Wed Mar 25 07:25:40 2020 From: Marc Feeley To: gambit-list@iro.umontreal.ca Subject: Re: [gambit-list] Gambit universal library in the browser Date: Wed, 25 Mar 2020 07:25:36 -0400 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6277937313652471366==" --===============6277937313652471366== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable > On Mar 25, 2020, at 5:47 AM, Duy Nguyen wrote: >=20 > On Wed, Mar 25, 2020 at 9:49 AM Marc Feeley wro= te: >>=20 >> With the latest commit the Gambit universal library can be used in the bro= wser=E2=80=A6 it is as simple as: >>=20 >> % make _gambit.js >> % gsc/gsc -:=3D -target js -exe -o webapp.js webapp.scm >> % open webapp.html >=20 > I just had to try, this is so cool. And gladly report back it worked > as expected. >=20 > A smarter linker next? A 31MB js file seems too much, even for a real > application, not just "hello world". > =E2=80=94=20 > Duy >=20 Yes the smart linker will definitely be useful here. It is an important mile= stone on my TODO as it will help all of the backends and integrate with the m= odule system. Although 31 MB is quite big, it is still usable for local development. The c= ompilation 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 var= ious methods. Marc-Andr=C3=A9 B=C3=A9langer has experimented with a code com= pressor (post-processing of the .js code) that reduces the size by a factor o= f 3. And when gzip compression is also enabled in the web server the final n= etwork 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 univ= ersal backend. Marc --===============6277937313652471366==-- From pclouds@gmail.com Wed Mar 25 07:35:44 2020 From: Duy Nguyen To: gambit-list@iro.umontreal.ca Subject: Re: [gambit-list] Gambit universal library in the browser Date: Wed, 25 Mar 2020 18:35:13 +0700 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4771115726622470326==" --===============4771115726622470326== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 25, 2020 at 6:25 PM Marc Feeley wrote: > 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 secon= d and the browser starts the app from the local file in a fraction of a secon= d, so the development loop is quite pleasant. > > For use on the web the generated JavaScript code could be compressed with v= arious methods. Marc-Andr=C3=A9 B=C3=A9langer has experimented with a code c= ompressor (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. Ah right. I forgot about compression. 1.5 MB is a very reasonable number. > If you are interested in working on minimizing the generated JavaScript cod= e please let me know and I can guide you through the relevant parts of the un= iversal backend. I'm afraid I'm not that capable. I used to use Gambit maybe ten years ago but stopped for some reason, now I don't remember a thing. Gambit looks quite attractive again :) I'll start using it more and hopefully will be able to contribute something back soon. --=20 Duy --===============4771115726622470326==-- From lassi@lassi.io Wed Mar 25 14:51:37 2020 From: Lassi Kortela To: gambit-list@iro.umontreal.ca Subject: Re: [gambit-list] Gambit universal library in the browser Date: Wed, 25 Mar 2020 20:51:29 +0200 Message-ID: <41f28454-4b4d-41eb-786d-a9efbee79852@lassi.io> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6848808889446090381==" --===============6848808889446090381== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable > For use on the web the generated JavaScript code could be compressed with v= arious methods. Marc-Andr=C3=A9 B=C3=A9langer has experimented with a code c= ompressor (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. AFAIK the de facto standard framework is still React. It's 40K. Elm, a=20 purely functional language with a built-in React-like framework, gets=20 down to 30K. The biggest popular frameworks are 100-150K. All of these=20 sizes are gzipped + minified (i.e. all identifiers compressed to the=20 shortest possible obfuscated ones, and all whitespace removed). Are there known tricks to get Gambit down to that 100-150K range? Sources: - https://elm-lang.org - https://gist.github.com/Restuta/cda69e50a853aa64912d --===============6848808889446090381==-- From feeley@iro.umontreal.ca Wed Mar 25 14:54:06 2020 From: Marc Feeley To: gambit-list@iro.umontreal.ca Subject: Re: [gambit-list] Gambit universal library in the browser Date: Wed, 25 Mar 2020 14:54:03 -0400 Message-ID: <57D85102-7541-4601-AAA9-F58E5EBB0B32@iro.umontreal.ca> In-Reply-To: <41f28454-4b4d-41eb-786d-a9efbee79852@lassi.io> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1678308787503619078==" --===============1678308787503619078== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit > On Mar 25, 2020, at 2:51 PM, Lassi Kortela wrote: > > Are there known tricks to get Gambit down to that 100-150K range? Yes… time! (smart linker…) Marc --===============1678308787503619078==--