Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!