Skip to content

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

Open

Description

@konsumer

@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.

Activity

  1. added
    raylib4Issues related to migration from raylib 3.5 to 4.
    on Feb 22, 2022
  2. twuky commented on Feb 22, 2022

    @twuky
    Collaborator

    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

  3. RobLoach commented on Feb 24, 2022

    @RobLoach
    Owner

    Wow!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    raylib4Issues related to migration from raylib 3.5 to 4.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions