From 77e33d9e1beb86bff2133b536777312abfeb58f6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 29 Sep 2018 23:01:36 +0200 Subject: [PATCH] Micro optimization in wxDisplay ctor Don't check for the index validity if it's 0, which is the most common case, as index 0 is always valid and so we can avoid calling GetCount(), which might have a non-trivial cost, completely. --- src/common/dpycmn.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/dpycmn.cpp b/src/common/dpycmn.cpp index ca4b1377a9..e7cb12aee5 100644 --- a/src/common/dpycmn.cpp +++ b/src/common/dpycmn.cpp @@ -115,7 +115,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxDisplayModule, wxModule); wxDisplay::wxDisplay(unsigned n) { - wxASSERT_MSG( n < GetCount(), + wxASSERT_MSG( n == 0 || n < GetCount(), wxT("An invalid index was passed to wxDisplay") ); m_impl = Factory().CreateDisplay(n);