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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generator: flatten structs & use refs better for more performance #114

Open
konsumer opened this issue Feb 22, 2022 · 2 comments
Open

generator: flatten structs & use refs better for more performance #114

konsumer opened this issue Feb 22, 2022 · 2 comments
Labels
raylib4 Issues related to migration from raylib 3.5 to 4.

Comments

@konsumer
Copy link
Collaborator

konsumer commented Feb 22, 2022

@twuky found that flattening structs on in/out gains some major performance. Here are the metrics on my system (linux, RTX 3050):

current

Screenshot from 2022-02-22 13-02-17

proposed

On twuky's tests I get insanely good FPS:

method: DrawTexture, args: 4, bunnies: 14920
method: DrawTextureNew, args: 4, bunnies: 95750
method: DrawTextureNewWhite, args: 4, bunnies: 100820
method: DrawTextureShortInt, args: 6, bunnies: 1000
method: DrawTexturePointer, args: 4, bunnies: 1000
method: DrawTextureShortWhite, args: 5, bunnies: 89900
method: DrawTextureShort, args: 9, bunnies: 65430
method: DrawBunnyWhite, args: 2, bunnies: 101670
method: DrawBunny, args: 6, bunnies: 79460
method: DrawBunnyBuffer, args: 1, bunnies: 55580
method: DrawTextureFlat, args: 11, bunnies: 62720
method: DrawTextureFlatWhite, args: 7, bunnies: 78390
method: DrawTextureShortBuffer, args: 6, bunnies: 65410

It's not a totally fair comparison, in the sense that branch has other optimizations (which we should also add to the generator) but the flat thing by itself will help, and refs will also help. We should try to do both in the generated code.

@konsumer konsumer added the raylib4 Issues related to migration from raylib 3.5 to 4. label Feb 22, 2022
@twuky
Copy link
Collaborator

twuky commented Feb 22, 2022

For more details on how the experimental benchmarks I wrote were implemented - reference #100 (comment)

Some documentation on what flattening arguments looks like in C++ and JS can be found in the raylib4 branch, in the generator docs: https://github.com/RobLoach/node-raylib/blob/raylib4/docs/generator/flattening_arguments.md

@RobLoach
Copy link
Owner

Wow!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
raylib4 Issues related to migration from raylib 3.5 to 4.
Projects
None yet
Development

No branches or pull requests

3 participants