Code Monkey home page Code Monkey logo

Comments (4)

Daninet avatar Daninet commented on June 9, 2024

Yeah, this would be interesting to explore. I planned to evaluate it together with the WebAssembly GC proposal when it appears in the engines.

In my use case, I only use reset(), which recreates the whole WASM memory region and it's super fast. I'm afraid that finalizers might create memory fragmentation which would randomly slow down the allocation of new objects.

Also writing a custom memory allocator in C is something that might be interesting to play with.

from gmp-wasm.

Daninet avatar Daninet commented on June 9, 2024

I have one more idea to explore:

  • Create a Webpack plugin which uses ESTree or some other JS parsers to automatically transform the callback function into raw GMP calls, when it's possible. It might be interesting to also check if it is possible to implement operator overloading.

from gmp-wasm.

danwallach avatar danwallach commented on June 9, 2024

I'm currently playing with building a finalizer-based wrapper that internally calls mpz_t_free. If I can somehow get it to work, I'll let you know.

from gmp-wasm.

jacobp100 avatar jacobp100 commented on June 9, 2024

I had a poke over here - https://github.com/jacobp100/mpfr

It does work. My end goal is to have it work with React Native, which doesn't have a finalization registry or wasm. You can provide an exports-like object that calls native functions, but for GC you register your own types with destructors (which is why there's a reference to gcHandle)

from gmp-wasm.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.