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

Avoid fetching GImPlot multiple times when possible. #468

Merged
merged 1 commit into from
Apr 19, 2023

Conversation

ocornut
Copy link
Collaborator

@ocornut ocornut commented Apr 17, 2023

Generally speaking, most non-local variables would be fetched again as the compiler needs to be conservative with any non-inline calls. So caching is desirable.
But this is particularly designed around the case of GImPlot being re-defined to be a thread_local variable, in which case the fetches triggers a little more platform-dependent machinery.

(PS: Aside from this, I would like to work on a mechanism for dear imgui to allow storing per-extension context pointers inside the main dear imgui context. I'll let you know if that happens.)

In the case this is a thread_local variable it is best to avoid fetching too many times.
Either way local caching tends to be beneficial as a non-local variable would often be fetched multiple times.
@ocornut ocornut merged commit 18758e2 into epezent:master Apr 19, 2023
azonenberg pushed a commit to ngscopeclient/implot that referenced this pull request Aug 16, 2023
In the case this is a thread_local variable it is best to avoid fetching too many times.
Either way local caching tends to be beneficial as a non-local variable would often be fetched multiple times.
Ben1138 pushed a commit to Ben1138/implot that referenced this pull request Oct 2, 2024
In the case this is a thread_local variable it is best to avoid fetching too many times.
Either way local caching tends to be beneficial as a non-local variable would often be fetched multiple times.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant