Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CanvasItem drawing benchmarks #70

Merged
merged 1 commit into from
Jun 14, 2024

Conversation

OverloadedOrama
Copy link
Contributor

@OverloadedOrama OverloadedOrama commented Jun 6, 2024

Adds the following benchmarks from #36:

  • 馃煡CPU馃煡 [CanvasItem]: Rendering: Draw different shapes (images, circles, etc) using the CanvasItem 2D drawing API. Draw 5000 elements. Measure performance.
  • 馃煡CPU馃煡 [CanvasItem]: Re-Rendering: Same as above, but every frame call queue_update() so it redraws. Measure performance.

I am quite puzzled as to why drawing the elements once sometimes results in more CPU & GPU time, than re-rendering them every frame. I added benchmarks for 10000 and 20000 elements in case 5000 is too low and it's being affected by an error margin, but I still get weird results for these benchmarks as well. Not sure if I'm doing something wrong, the logic seems fine to me, but let me know if I should keep or remove the benchmarks for 10000 & 20000 elements.

Results on my PC

{
"benchmarks": [
{
"category": "Rendering > Canvas Item",
"name": "Draw 10 000 Shapes Every Frame",
"results": {
"render_cpu": 2.542,
"render_gpu": 4.311,
"time": 0.029
}
},
{
"category": "Rendering > Canvas Item",
"name": "Draw 10 000 Shapes Once",
"results": {
"render_cpu": 2.563,
"render_gpu": 4.435,
"time": 0.035
}
},
{
"category": "Rendering > Canvas Item",
"name": "Draw 20 000 Shapes Every Frame",
"results": {
"render_cpu": 5.243,
"render_gpu": 8.6,
"time": 0.023
}
},
{
"category": "Rendering > Canvas Item",
"name": "Draw 20 000 Shapes Once",
"results": {
"render_cpu": 5.02,
"render_gpu": 8.739,
"time": 0.049
}
},
{
"category": "Rendering > Canvas Item",
"name": "Draw 5000 Shapes Every Frame",
"results": {
"render_cpu": 1.216,
"render_gpu": 2.162,
"time": 0.041
}
},
{
"category": "Rendering > Canvas Item",
"name": "Draw 5000 Shapes Once",
"results": {
"render_cpu": 1.336,
"render_gpu": 2.21,
"time": 0.1
}
}
],
"engine": {
"version": "v4.3.beta1.official",
"version_hash": "a4f2ea91a1bd18f70a43ff4c1377db49b56bc3f0"
},
"system": {
"cpu_architecture": "x86_64",
"cpu_count": 12,
"cpu_name": "AMD Ryzen 5 1600 Six-Core Processor",
"os": "Linux"
}
}

@Calinou
Copy link
Member

Calinou commented Jun 14, 2024

I am quite puzzled as to why drawing the elements once sometimes results in more CPU & GPU time, than re-rendering them every frame. I added benchmarks for 10000 and 20000 elements in case 5000 is too low and it's being affected by an error margin, but I still get weird results for these benchmarks as well. Not sure if I'm doing something wrong, the logic seems fine to me, but let me know if I should keep or remove the benchmarks for 10000 & 20000 elements.

The results I get are logical on my end:

Running benchmark 1 of 6: rendering/canvas_item/draw_10_000_shapes_every_frame
Result: {"render_cpu":0.7615,"render_gpu":1.54,"time":0.012}

Running benchmark 2 of 6: rendering/canvas_item/draw_10_000_shapes_once
Result: {"render_cpu":0.6177,"render_gpu":1.302,"time":0.013}

Running benchmark 3 of 6: rendering/canvas_item/draw_20_000_shapes_every_frame
Result: {"render_cpu":2.107,"render_gpu":3.457,"time":0.014}

Running benchmark 4 of 6: rendering/canvas_item/draw_20_000_shapes_once
Result: {"render_cpu":1.688,"render_gpu":2.677,"time":0.03}

Running benchmark 5 of 6: rendering/canvas_item/draw_5000_shapes_every_frame
Result: {"render_cpu":0.3111,"render_gpu":0.8509,"time":0.016}

Running benchmark 6 of 6: rendering/canvas_item/draw_5000_shapes_once
Result: {"render_cpu":0.2862,"render_gpu":0.6509,"time":0.014}
PC specifications
  • CPU: Intel Core i9-13900K
  • GPU: NVIDIA GeForce RTX 4090
  • RAM: 64 GB (2脳32 GB DDR5-5800 C30)
  • SSD: Solidigm P44 Pro 2 TB
  • OS: Linux (Fedora 39)

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Calinou Calinou merged commit 6630e6e into godotengine:main Jun 14, 2024
@OverloadedOrama OverloadedOrama deleted the canvasitem-rendering branch June 16, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants