-
Notifications
You must be signed in to change notification settings - Fork 14
Boost performance? #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From my personal experience, using @kmamal/gl will be the best choice, although it's harder to use and require knowledge about shader and stuff like that, but you can get way better performance using it. Beside from some GC and memory leak issue you may encounter, it's pretty good! Also I don't think you can make canvas faster ( |
I think I could make canvas write to the window directly, eliminating some of the buffer copying. I'll keep this issue open to track that effort. There's also a chance that you are doing something weird with your code that needlessly reduces performance. I'd be happy to have a look if you are able to upload the repo. Failing that, switching to webgl/gpu is always an option, and there are libraries that make working with them much easier. |
@LmanTW do you think the memory leak you encountered was a bug in kmamal/gl? |
Simply, it's just the same 59-60 fps just like an empty canvas on HTML page. But in the code it's just clear the canvas and draw a rectangle, and input check |
I think it was because I keep using Now I think about it it's quite silly, so I don't think it's an issue in |
I just found out that skia-canvas actually supports rendering the canvas to an OS window. It also has some window events like |
Interesting |
Also https://github.com/Brooooooklyn/canvas is node bindings for skia-canvas. I'm even getting decent fps on a bunch of these cheap Anbernic retro game devices (arm64 chips with 1g ram, running knulli linux) |
after some testing, it seems that One thing to make sure is that when you're calling window.render do this:
and NOT
HUGE performance difference between those two. The latter does a memory copy that is very slow and gets worse in high resolutions. |
once this gets resolved, performance with this library + @napi-rs/canvas is going to be fantastic: @kmamal really greatful to you for working on this library |
Is anyone still facing serious performance issues? Let me know if you do, otherwise this issue is on hold for now. |
I still think gl is the best option to make this work for games, else canvas would only be fit for things that don't require constant rerendering. |
Is using
the FPS I'm seeing fluctuates a lot around at 60. At times it even goes to 70 or reduces to 30. If I use skia-canvas' own Window, I get a proper 60±1 FPS. Am I doing something wrong here? Or is this expected? |
Is there a way to boost performance for the canvas version? Or should I choose WebGL instead?
The text was updated successfully, but these errors were encountered: