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>
This commit is contained in:
parent
93b4e362f9
commit
d85cb38322
1 changed files with 17 additions and 0 deletions
|
@ -7553,6 +7553,23 @@ static void preloadData()
|
|||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
static const OUString preloadComponents[] = {
|
||||
"private:factory/swriter",
|
||||
"private:factory/scalc",
|
||||
"private:factory/simpress",
|
||||
"private:factory/sdraw"
|
||||
};
|
||||
// getting the remote LibreOffice service manager
|
||||
uno::Reference<frame::XDesktop2> xCompLoader(frame::Desktop::create(xContext), uno::UNO_QUERY);
|
||||
|
||||
// Preload and close each of the main components once to initialize global state
|
||||
uno::Sequence<css::beans::PropertyValue> szEmptyArgs(0);
|
||||
for (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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue