Cache wxDisplayImpl object for faster access

Avoid a heap allocation on every wxDisplay creation by caching the
wxDisplayImpl objects once they're created.

Currently we never invalidate the cache, but we should add a way to do
it in the future.

This speeds up wxDisplay::GetGeometry() benchmark by a factor of 4.
This commit is contained in:
Vadim Zeitlin
2018-09-30 00:53:59 +02:00
parent d6793893c0
commit 990c8bfd73
3 changed files with 36 additions and 12 deletions

View File

@@ -50,7 +50,6 @@ public:
// dtor is not virtual as this is a concrete class not meant to be derived
// from
~wxDisplay();
// return the number of available displays, valid parameters to