summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2025-01-17 09:40:17 -0800
committerThiago Macieira <thiago.macieira@intel.com>2025-01-23 18:09:38 -0800
commit39564261b213b22a7e170baf4528d125260b5436 (patch)
tree7607fd7031db02b8dc0d0945359e568d093bb1a6 /src
parent918566aeddbbf56f8539c44bcd45223d2fbab996 (diff)
QThread/Linux: disable the filling in of the trivial cpuset variable
We don't need it and it just makes the code slower with a large array. Change-Id: I06dfa436309bfd249c06fffddb4cec658cf356a9 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/thread/qthread_unix.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index f8bf4ba63c9..0a907511d80 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -489,6 +489,11 @@ Qt::HANDLE QThread::currentThreadIdImpl() noexcept
int QThreadPrivate::idealThreadCount = 1;
#endif
+#if QT_CONFIG(trivial_auto_var_init_pattern) && defined(Q_CC_GNU_ONLY)
+// Don't pre-fill the automatic-storage arrays used in this function
+// (important for the FreeBSD & Linux code using a VLA).
+__attribute__((optimize("trivial-auto-var-init=uninitialized")))
+#endif
int QThread::idealThreadCount() noexcept
{
int cores = 1;