summaryrefslogtreecommitdiff
path: root/sal/osl
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-06-19 10:02:42 +0300
committerAndras Timar <andras.timar@collabora.com>2018-06-19 09:52:56 +0200
commit17ddc78c2d0ff1b2af82cb8e8ed9c5db3f959d19 (patch)
treef4c855444900f23cfbf20b80cbb9b7656b04ef3e /sal/osl
parentaf8f93e0a538c0e69aa7255d7653baa6bea9e393 (diff)
Don't waste time in macxp_resolveAlias() on files inside the app bundle
LibreOffice uses its low-level API to look up hundreds of files inside the app bundle all the time, and especially when starting as a whole, or when starting specific aspects of the application (like after typing a first character into a Writer document in a session). Having all those go through this alias or bookmark dance is just insane. There won't be any there. This shaves almost a second from the delay after typing the first character into a Writer document in a session. There is still a noticeable delay left, though, likely mostly caused by Python (Lightproof) initialisation slowness. (It's cross-platform.) I would say that it is a bit questionable whether the macxp_resolveAlias() functionality is worth it at all, even. Change-Id: I2461141c6b58738befd0db4902eb25e63b788b79 Reviewed-on: https://gerrit.libreoffice.org/56081 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sal/osl')
-rw-r--r--sal/osl/unx/system.cxx13
-rw-r--r--sal/osl/unx/system.mm1
2 files changed, 14 insertions, 0 deletions
diff --git a/sal/osl/unx/system.cxx b/sal/osl/unx/system.cxx
index 7003b4ff5a41..9b7f05d93b28 100644
--- a/sal/osl/unx/system.cxx
+++ b/sal/osl/unx/system.cxx
@@ -37,6 +37,10 @@
#define RTL_MUTEX_LOCK
#define RTL_MUTEX_UNLOCK
+#include <premac.h>
+#include <Foundation/Foundation.h>
+#include <postmac.h>
+
#else //defined(MACOSX)
static pthread_mutex_t getrtl_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -162,6 +166,15 @@ int macxp_resolveAlias(char *path, int buflen)
CFErrorRef cferror;
CFDataRef cfbookmark;
+ // Don't even try anything for files inside the app bundle. Just a
+ // waste of time.
+
+ static const char * const appBundle = [[[NSBundle mainBundle] bundlePath] UTF8String];
+
+ const size_t appBundleLen = strlen(appBundle);
+ if (strncmp(path, appBundle, appBundleLen) == 0 && path[appBundleLen] == '/')
+ return 0;
+
char *unprocessedPath = path;
if ( *unprocessedPath == '/' )
diff --git a/sal/osl/unx/system.mm b/sal/osl/unx/system.mm
new file mode 100644
index 000000000000..7495a3e73058
--- /dev/null
+++ b/sal/osl/unx/system.mm
@@ -0,0 +1 @@
+#include "system.cxx"