Skip to content

Profile performances of arbitrary attributes #11

Open

Description

@eliemichel

We should profile the amount of new memory allocation when manipulating arbitrary attributes, and organize the API in a way that hints the user into using the most efficient approach. For instance:

v1.attributes["uv"] = new FloatAttributeValue(0.0f, 0.0f);

is less efficient than

var uv = v1.attributes["uv"].asFloat();
uv.data[0] = 0.0f;
uv.data[1] = 0.0f;

but the latter is a bit annoying to write.

Activity

  1. MechWarrior99 commented on Feb 4, 2022

    @MechWarrior99
    Contributor

    So I was going to add some QoL to the attribute API to encourage better (and easier) usage, but I realized that it is kind of limited and clunky as is. For example doesn't support other types like bool, or string.
    So I was thinking refactoring it, but I saw in a comment in AttributeType you mention using data buffers. Are you able to elaborate on what you had in mind?

  2. eliemichel commented on Mar 29, 2022

    @eliemichel
    OwnerAuthor

    Storing vertex attribute values on a per-vertex basis fragments the memory and does a lot of repeated allocations when adding a new attribute. It would be much more efficient to allocate an array with all values for an attribute written consecutively (making the vertex list a struct of arrays rather than an array of structs), but this makes the addition/deletion of vertices trickier so I am not decided yet about the best design. (ofc it goes the same for edge, loop and face attributes).

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions