Sunday 16 June 2013

Re: [Ubuntu-phone] MeeGo applauncherd: faster application startup and more

On 06/17/2013 09:43 AM, Thomas Voß wrote:
> Hey Alberto,
>
> thanks for bringing this up. Upstart user session will take care of
> single application instances and integrates with AppArmor to implement
> our confinement strategy (for >= saucy). The interesting feature from
> my pov is the accelerated application startup. Is that relying on
> preloading specific symbols?

It relies on mainly two points:
1) preloading libraries
2) preinitializing objects

1) Works by linking the booster process with some libraries that are
very likely to be used by the application, and dlopen()'ing commonly
used modules. For example, the booster for Ubuntu Qt application could
be an executable linking with Qt5Core, Qt5Gui, Qt5Declarative and having
dlopen()'ed the Qt Jpeg, Svg, sqlite, plugins.
Then, when the user wants to start a Qt5 application, the booster would
dlopen() the application's executable and run its main() function; this
would be faster than starting an application from scratch because:
a) no forking is needed (forking happens as soon as an app has been
launched, to be ready for the next one)
b) most libraries/modules have already been loaded


2) All graphical Qt applications will use QGuiApplication, and most of
them will also initialize a QQuickWindow; these apps could be easily
modified to retrieve a pre-initialized instance of these objects, which
the booster process has prepared before knowing which application is
going to be started next.


Note that 1) doesn't actually require any modification to an
application's code (it only requires that the main() symbols is
exported), while 2) requires some additional 1-line modifications, so
that instead of doing:
QGuiApplication *app = new QGuiApplication(argc, argv);
one would do
QGuiApplication *app = MComponentCache::qGuiApplication(argc, argv)

Ciao,
Alberto

--
ubuntu-devel mailing list
ubuntu-devel@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel