There are two QHashPrivate::Data constructors (and two overloads of ::detached()). Initially the Data ctor that takes a new size always assumed a resize was happening, and any place where there _may_ be a resize we would usually detach then rehash. In an effort to avoid the detach+rehash and instead call detach(d, size) without the performance overhead of rehashing the call to reallocationHelper() in this overload of the ctor was changed to verify that a rehash was actually needed. This had the unfortunate side-effect of making the compiler no longer inline the reallocationHelper() function, and it no longer expanded the if-expression with the constant so it was doing a tight copy-loop with a potential branch in the middle. In this patch we revert that and make the bool a template argument to highlight that it should be a constant for better performance (but also leaving a comment.) Also mark it Q_ALWAYS_INLINE, it has two uses and they both take advantage of the inlining + expanding the expression. In theory this might have had an impact on QHash::reserve() calls, though this code is only relevant when reserve() would cause growth so the performance regression would hopefully be small compared to all the other work that would also be needed. Reverts 45c137d797a85c694897e8b1c5099abacc16e2f5 Pick-to: 6.9 6.8 Change-Id: I0d2076a9ded8ca816c54d6ce42d472a23bcbc9fd Reviewed-by: Lars Knoll <lars@knoll.priv.no> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
…
…
Description
Languages
C++
84.3%
HTML
4.9%
C
3.9%
CMake
3.6%
Objective-C++
2%
Other
0.8%