Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda