Improve the loading performance of QLibrary
authorSean Harmer <sean.harmer@kdab.com>
Wed, 18 Jul 2012 12:12:46 +0000 (13:12 +0100)
committerQt by Nokia <qt-info@nokia.com>
Mon, 23 Jul 2012 15:56:13 +0000 (17:56 +0200)
commit0026b80cd2a484ad9d685ff5a4f89e6c9815f913
treeb62c9edd46c777e24aedfe2b8b7a2b46594e2f5c
parentb1829403408aebdf62b61dcefdb96b0457b9bd3e
Improve the loading performance of QLibrary

If an absolute path is specified we try that first. Otherwise we first
try the most likely system-specific format (e.g. libfoo.so) on Unix.
This improves performance especially on systems with slow flash devices.

For example, prior to this commit loading the Xcursor library (in the
xcb plugin) results in attempts to dlopen:

"Xcursor"
"Xcursor.so.1"
"libXcursor"
"libXcursor.so.1"

With this commit this is reduced to a single attempt of:

"libXcursor.so.1"

Plugin loading uses absolute paths with QLibrary so there is no
performance penalty for plugins with this commit.

This is however a behavioural change with respect to Qt4 but one
that I believe is justified and wanted.

Change-Id: I7813afa335f9bf515e87934c2f8f97888818c69c
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
src/corelib/plugin/qlibrary.cpp
src/corelib/plugin/qlibrary_unix.cpp
src/corelib/plugin/qlibrary_win.cpp