epezent / implot

Immediate Mode Plotting
MIT License
4.55k stars 503 forks source link

Avoid fetching GImPlot multiple times when possible. #468

Closed ocornut closed 1 year ago

ocornut commented 1 year ago

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