From cf572c3b5224b1edd849e7c71fde470287cda6ba Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Fri, 11 Aug 2017 18:30:06 +0200 Subject: [PATCH] Remove application directory from QCoreApplication::libraryPaths() Summary: The directory containing the main application (read through argv[0]) is by default added to the list of paths containing libraries. This causes various methods to iterate through all entries of the plasmashell install location, usually /usr/bin. By explicitly removing the path, those unnecessary lookups can be avoided, resulting in around 100ms quicker startup on a system with 4000 entries in /usr/bin. Test Plan: Ran plasmashell with and without this fix, no changes except for a slightly quicker startup and much less strace noise. Reviewers: #plasma Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D7255 --- shell/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shell/main.cpp b/shell/main.cpp index 8f78a106f..00e6b5f55 100644 --- a/shell/main.cpp +++ b/shell/main.cpp @@ -60,6 +60,10 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); + // The executable's path is added to the library/plugin paths. + // This does not make much sense for plasmashell. + app.removeLibraryPath(QCoreApplication::applicationDirPath()); + KQuickAddons::QtQuickSettings::init(); KAboutData aboutData(QStringLiteral("plasmashell"),