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

Consider caching of DisplayedString #281

Open
eXpl0it3r opened this issue Jan 13, 2025 · 0 comments
Open

Consider caching of DisplayedString #281

eXpl0it3r opened this issue Jan 13, 2025 · 0 comments
Labels
Feature New functionality or extending of an existing one

Comments

@eXpl0it3r
Copy link
Member

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.

@eXpl0it3r eXpl0it3r added the Feature New functionality or extending of an existing one label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New functionality or extending of an existing one
Projects
None yet
Development

No branches or pull requests

1 participant