Track tasks and feature requests
Join 40 million developers who use GitHub issues to help identify, assign, and keep track of the features and bug fixes your projects need.
Sign up for free See pricing for teams and enterprisesSpriteBatch poor performance in 2D compared to MonoGame #428
Comments
This comment has been minimized.
This comment has been minimized.
My 2d game have lots of textures to draw(around 8000 triangles and 1000 draw-calls). is where the performance issue lied down. In the method, there are too many memory copy. And it's per-texture method-call. |
This comment has been minimized.
This comment has been minimized.
According the cpu profile result: |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
That's not relevant. Anything higher than 120 FPS cannot be called "poor performance". There is no point of rendering the scene at a higher rate than the screen refresh rate. If you want a fair comparison, try a game where the framerate is close to that refresh rate. Xenko and monogame makes different architecture and performance tradeoff decisions. Sure, the commandlist has some overhead but the point is to actually have better performance when it maters (i.e. when the FPS would normally drop much lower). I can write a fixed-pipeline that only clears the screen and has 1000+ FPS, but it doesn't make that "engine" any better. To be clear, I'm not saying there is nothing wrong or that could be improved in Xenko just that your test case and comparison is not a good one. |
This comment has been minimized.
This comment has been minimized.
@ryancheung included more context on discord, here's an excerpt that seems more relevant: It would be nice if you could create a repro' or include more info regarding the 20 fps case. |
This comment has been minimized.
This comment has been minimized.
In local single player test, FPS can drops from 520 to 40. Until it goes below 30~, the FPS are acceptable. I'll update the report if the game FPS drops to ~20 in a heavy-load case. Let's just keep this open for now. And after some time in future. I'll test the game in Mobile and see the performance. |
This comment has been minimized.
This comment has been minimized.
Just had another performance test and it shows how FPS drops in Xenko to below 30: So, I believe Xenko has some more performance refinement in Sprite Batching. |
This comment has been minimized.
This comment has been minimized.
@xen2 Thanks for the memory leak fix and I’ll test it if the fix also improving performance. Thank you for your work! |
This comment has been minimized.
This comment has been minimized.
@ryancheung thanks, keep me posted! |
This comment has been minimized.
This comment has been minimized.
@xen2 The memory leak bug is actually fixed. But it seems not improving the performance. |
This comment has been minimized.
This comment has been minimized.
Depends on how you use sprites and how many of them. Without a repro project, posting image rendering is not going to help solve the issue. |
SpriteBatch poor performance in 2D compared to MonoGame.
I've got very poor 2d performance on SpriteBatch. Compared to MonoGame, my game only got ~500FPS, but in MonoGame, it can be ~700-800FPS.
And I found another performance issue:
If I do:
Sprite = new SpriteBatch(Device, 5000, 1000);
The FPS Drop nearly 40% percent. The default buffer element count is 1024, and batch capaticy is 64 when initializing SpriteBatch.
There should be some poor performance code in SpriteBatch internal array resizing.