[HN Gopher] New QuickJS Release
       ___________________________________________________________________
        
       New QuickJS Release
        
       Author : rdtsc
       Score  : 66 points
       Date   : 2023-12-09 17:08 UTC (5 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | simonw wrote:
       | First release since 2021-03-27.
        
       | ijustlovemath wrote:
       | QuickJS is really cool! You can use it to embed JS code in a
       | native binary, which is nice if you're trying to use a NodeJS
       | library outside of the JS ecosystem.
       | 
       | I put together a proof of concept for this about a year ago, in
       | case this is a use case you currently have:
       | https://github.com/ijustlovemath/jescx
        
         | ikari_pl wrote:
         | stupid question but... doesn't Deno also promise that
         | possibility? Or at least to compile a js app into a binary
        
           | wild_egg wrote:
           | Even if it does, it's always nice to have other options with
           | different trade-offs
        
             | schemescape wrote:
             | As an example, I had a Makefile that ran a JS engine a few
             | hundred times and Deno had ~240ms of startup overheard (on
             | a very slow computer) versus QuickJS having around 20ms.
             | But when running CPU-intensive JS (Marked.js and
             | highlight.js), Deno was roughly 6x faster.
             | 
             | I wanted to try Bun, but it had some blocking bugs at the
             | time (which have since been resolved--or so I've read).
        
           | keb_ wrote:
           | Yes, although the sizes of the binaries differ greatly. See
           | this [1] Twitter reply. A "hello world" example produced an
           | ~85mb binary in Node and Deno, whereas QuickJS produced a 6MB
           | binary.
           | 
           | [1] https://nitter.net/kebsworld/status/1648488613351657474#m
        
       | firefoxd wrote:
       | One quick improvement would be to have a Readme.
        
         | rdtsc wrote:
         | There is a readme on the project's main page:
         | https://bellard.org/quickjs/
         | 
         | The newsworthy bit here is that the activity seemed to have
         | stalled for year or two and now Fabrice pushed a few fixes and
         | made a new release.
        
       | keb_ wrote:
       | Also see quickjs-ng [0], which is a fork in active development. A
       | lot of missing ES features have already been added. [1]
       | 
       | [0] https://github.com/quickjs-ng/quickjs
       | 
       | [1] https://github.com/quickjs-ng/quickjs/issues/54
        
       | tyleo wrote:
       | We've been considering this library at work for a performance
       | sensitive application (real time game). Can anyone here speak to
       | the performance and memory usage of QuickJS?
        
         | Ennea wrote:
         | Out of curiosity, why not Lua?
        
           | szundi wrote:
           | Is Lua performance sensitive? Other guess is Javascript is
           | much more programmer friendly than Lua.
        
             | nequo wrote:
             | Some would argue Lua is friendlier than JS.
             | 
             | LuaJIT is pretty good as far as performance goes. In these
             | benchmarks, sometimes slower than Node/Bun but uses
             | consistently less memory too:
             | 
             | https://programming-language-benchmarks.vercel.app/lua-vs-
             | ja...
        
         | plesiv wrote:
         | Here are some benchmarks:
         | https://bellard.org/quickjs/bench.html
        
         | rdtsc wrote:
         | Performance is pretty good if you consider starting and running
         | small scripts. There is an interesting feature of compiling a
         | js file into a C array bytecode so your runtime code could load
         | that directly skipping the parsing step.
         | 
         | For a long running orlarge JS code something like Spidermonkey
         | or V8 with their JITs might be faster. But they are not as
         | embedding friendly and their code bases are much larger.
        
       | gigel82 wrote:
       | I'm glad the project isn't dead-dead but still not a good sign it
       | didn't get any love for 2+ years.
        
         | sylware wrote:
         | I guess because it is mostly finished.
         | 
         | Just need adding some new "pertinent" standard stuff, once in
         | while.
        
       | jitl wrote:
       | I just upgraded quickjs-emscripten - my JS-in-JS wrapper library
       | - to this new version of the upstream quickjs.
       | 
       | If you want to safely evaluate untrusted Javascript in the
       | browser or Node with control over CPU time and memory use, a
       | custom module system, or call async code synchronously, check it
       | out: https://github.com/justjake/quickjs-emscripten
       | 
       | It's used by a few projects like Hoppscotch, a Postman-like
       | visual API client (https://hoppscotch.io/). They use it for
       | request scripting:
       | https://docs.hoppscotch.io/documentation/getting-started/res...
        
       | sylware wrote:
       | When I look at quickJS, I am thinking: Can we design a DOM,
       | minimal enough, but good enough for a new "web", with ultra
       | stable ABIs/APIs in time, which would not require one of the
       | grotesquely and absurdely massive and complex current web
       | engines? (including their SDKs). Which I could compile with a
       | near 0 SDK and a simple C compilers (avoiding the latest ISO C
       | tantrums and compiler-specific extensions)
       | 
       | Event loops, a dynamic pixel canvas, very little and basic
       | audio/video/network/vector drawing interfaces.
       | 
       | Something along that line. I know that the hard parts would be to
       | decide when this framework is "done" and keep it immune to non
       | critical change/feature creeps etc.
        
       | devgonewild wrote:
       | Whats the difference between this and JS Shadow Realms? At a
       | glance it sounds similar
        
         | devgonewild wrote:
         | Sorry, actually went to the website itself and read up on
         | QuickJS - the repo wasn't clear due to lack of read-me.
        
       ___________________________________________________________________
       (page generated 2023-12-09 23:02 UTC)