summaryrefslogtreecommitdiff
path: root/desktop/source/lib
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2024-02-02 18:16:40 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-02-09 12:54:46 +0100
commitba0773e50b7058f12981c4d29fb05c34d7486290 (patch)
tree93c0fe2fe20d6408f46417ff727c3100dc642b3b /desktop/source/lib
parenta67cd7b3cf03163f87811f7080cabc49750c4fd5 (diff)
preload: open and close empty documents of main types in preinit.
Some quick testing suggest this saves ~800k for writer, ~3Mb for impress each loading an ~empty hello-world document. Change-Id: I9a7bc25d38d82b5556dfb04a99d5c145dd71ffec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162939 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit d85cb3832286ae1fdcf4a8494abb8212f21e4e9a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163148 Tested-by: Jenkins
Diffstat (limited to 'desktop/source/lib')
-rw-r--r--desktop/source/lib/init.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0db7e1010156..1742488a7cf9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -7543,6 +7543,23 @@ static void preloadData()
#pragma GCC diagnostic pop
#endif
+ static constexpr OUString preloadComponents[] = {
+ u"private:factory/swriter"_ustr,
+ u"private:factory/scalc"_ustr,
+ u"private:factory/simpress"_ustr,
+ u"private:factory/sdraw"_ustr
+ };
+ // getting the remote LibreOffice service manager
+ uno::Reference<frame::XDesktop2> xCompLoader(frame::Desktop::create(xContext));
+
+ // Preload and close each of the main components once to initialize global state
+ uno::Sequence<css::beans::PropertyValue> szEmptyArgs(0);
+ for (const auto& component : preloadComponents)
+ {
+ auto xComp = xCompLoader->loadComponentFromURL(component, "_blank", 0, szEmptyArgs);
+ xComp->dispose();
+ }
+
// Set user profile's path back to the original one
rtl::Bootstrap::set(u"UserInstallation"_ustr, sUserPath);
}