[HN Gopher] Turbocall - Just-in-time compiler for Deno FFI
       ___________________________________________________________________
        
       Turbocall - Just-in-time compiler for Deno FFI
        
       Author : undefined_void
       Score  : 69 points
       Date   : 2024-03-25 07:41 UTC (15 hours ago)
        
 (HTM) web link (divy.work)
 (TXT) w3m dump (divy.work)
        
       | pjmlp wrote:
       | This is one of the approaches for FFI taken by other runtimes,
       | however it has the issue that without binding generators
       | (jextract, P/Invoke code generators, ctypesgen), the type
       | declarations are a pain to write.
       | 
       | Thus something like this would need a similar tool.
        
         | aapoalas wrote:
         | deno_bindgen exists which can be used to do this from Rust.
         | 
         | I have written a partial solution for C, though it is bespoke
         | for my libclang bindings, and a very rough one for C++. Both of
         | these require more work to really be ready-to-use tools
         | however.
         | 
         | [1] libclang C binding generator:
         | https://github.com/aapoalas/libclang_deno/blob/main/build/bu...
         | 
         | [2] C++ binding generator: https://github.com/aapoalas/txx
        
           | pjmlp wrote:
           | I see, thanks for the heads up.
        
       | AbuAssar wrote:
       | it is refreshing to witness deno surpasses bun in a benchmark!
        
       | diath wrote:
       | Honestly I feel like they should work first on API compatibility
       | with NodeJS just so that it can be easier to adopt/migrate
       | seamlessly, then try more improvements in the runtime. It's nice
       | that they have performance optimizations but what are they good
       | for when I can't use Deno because it's not compatible/missing
       | APIs?
        
         | aapoalas wrote:
         | This feature and these APIs have been in Demo for a few years
         | at this point.
        
         | Kamq wrote:
         | This is only one strategy to get adoption. The other is to have
         | better apis/more features so that new projects gradually move
         | to your runtime.
         | 
         | In this hypothetical, eventually being on node would become
         | like still being on java 8 is today.
        
       | tekknolagi wrote:
       | We built something similar for pypy! See the blog post:
       | https://bernsteinbear.com/blog/typed-c-extensions/ and paper:
       | https://arxiv.org/abs/2403.02420
       | 
       | TL;DR: similar speedups! It works well
        
       | chatmasta wrote:
       | There have been a lot of security bugs in Chrome related to this
       | layer of V8, most of them caused by some form of type confusion.
       | Is there worry about increasing the size of Deno's attack surface
       | by adding this capability?
        
       ___________________________________________________________________
       (page generated 2024-03-25 23:01 UTC)