Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
Wasm-bindgen overhead for a canvas game?

I learned about how can I use the canvas from rust and wasm-bindgen (example like this: https://rustwasm.github.io/wasm-bindgen/examples/2d-canvas.html). It is pretty fast, but I am guessing still there must be an overhead for every canvas call, right? So the proper solution for a canvas-based game would be: canvas drawing calls from a javascript function, game logic running on rust/wasm, and call the js drawing function with game state data?

So I should avoid thousands of canvas draw calls from wasm-bindgen for optimal performance, right?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It is really hard to say which approach would be the best. If you keep the canvas in rust code, then you need to worry about keeping the state in sync with calling functions. In this case, I think the event loop would had to do hard work.

Browser is our view layer. So keep the viewing job to javascript and just call the backend. It is like creating a restful API and just sending API requests to the endpoint, we get the data and javascript updates the UI. In this approach, you have to use raw pointers to access memory in rust code and this is not a safe approach.

One benefit of keeping canvas in rust code, then you can ship this code to different platforms, so your rust code will be compact and reusable.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda