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>
This commit is contained in:
Thiago Macieira 2025-01-17 09:40:17 -08:00
parent 918566aedd
commit 39564261b2

View File

@ -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;