Skip to content

Consider caching of DisplayedString #281

Open
@eXpl0it3r

Description

@eXpl0it3r

Currently, every call of DisplayedString does a marshalling from/to C and copying of the string data.
If you update the Text instance often (e.g. FPS counter), than we're wasting a lot of processing time to convert and allocate memory to get the string data.

It would be less expensive too cache the string data on C# side. As there isn't anything on SFML's side that could lead to a change of the string on its own, it should be fine to update the string data in the set method and have return only return the cached value.

Three (?) edge cases to consider:

  • set has never been called
  • Text instance was copied
  • CPointer changes somehow

See also forum thread.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew functionality or extending of an existing one

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions