D10512: try to preload certain applets in a smart way

2018-02-21 Thread Kai Uwe Broulik
broulik added inline comments.

INLINE COMMENTS

> anthonyfieroni wrote in appletquickitem.cpp:57-68
> But if PLASMA_PRELOAD_POLICY is not setted s_preloadPolicy stays 
> Uninitialized, no? But since you check against >= Adaptive it's still ok :)

https://cgit.kde.org/plasma-framework.git/commit/?id=fa9d4be5d1663e912e34a5ed581a3bfee159dab8

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: anthonyfieroni, davidedmundson, broulik, apol, ngraham, plasma-devel, 
#frameworks, michaelh, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, 
abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-20 Thread Anthony Fieroni
anthonyfieroni added inline comments.

INLINE COMMENTS

> mart wrote in appletquickitem.cpp:57-68
> > So Adaptive can a default even environment variable is not setted?
> 
> yes, adaptive is the default
> 
> > Furthermore you can make a static function to access value
> 
> it's done anyways only once as preloadPolicy is already a static?

But if PLASMA_PRELOAD_POLICY is not setted s_preloadPolicy stays Uninitialized, 
no? But since you check against >= Adaptive it's still ok :)

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: anthonyfieroni, davidedmundson, broulik, apol, ngraham, plasma-devel, 
#frameworks, michaelh, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, 
abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-20 Thread Marco Martin
mart added inline comments.

INLINE COMMENTS

> anthonyfieroni wrote in appletquickitem.cpp:57-68
> So Adaptive can a default even environment variable is not setted?
> Furthermore you can make a static function to access value
> 
>   AppletQuickItemPrivate::PreloadPolicy AppletQuickItemPrivate::appletPolicy()
>   {
>   static const PreloadPolicy preloadPolicy = []() -> PreloadPolicy {
>   if (qEnvironmentVariableIsSet("PLASMA_PRELOAD_POLICY")) {
>   const QString policy = 
> QString::fromUtf8(qgetenv("PLASMA_PRELOAD_POLICY")).toLower();
>   if (policy == QStringLiteral("aggressive")) {
>   return Aggressive;
>   } else if (policy == QStringLiteral("none")) {
>   return None;
>   }
>   }
>   return Adaptive;
>   }();
>   return preloadPolicy;
>   }

> So Adaptive can a default even environment variable is not setted?

yes, adaptive is the default

> Furthermore you can make a static function to access value

it's done anyways only once as preloadPolicy is already a static?

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: anthonyfieroni, davidedmundson, broulik, apol, ngraham, plasma-devel, 
#frameworks, michaelh, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, 
abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-19 Thread Anthony Fieroni
anthonyfieroni added inline comments.

INLINE COMMENTS

> appletquickitem.cpp:57-68
> +if (s_preloadPolicy == Uninitialized) {
> +if (qEnvironmentVariableIsSet("PLASMA_PRELOAD_POLICY")) {
> +const QString policy = 
> QString::fromUtf8(qgetenv("PLASMA_PRELOAD_POLICY")).toLower();
> +if (policy == QStringLiteral("aggressive")) {
> +s_preloadPolicy = Aggressive;
> +} else if (policy == QStringLiteral("none")) {
> +s_preloadPolicy = None;

So Adaptive can a default even environment variable is not setted?
Furthermore you can make a static function to access value

  AppletQuickItemPrivate::PreloadPolicy AppletQuickItemPrivate::appletPolicy()
  {
  static const PreloadPolicy preloadPolicy = []() -> PreloadPolicy {
  if (qEnvironmentVariableIsSet("PLASMA_PRELOAD_POLICY")) {
  const QString policy = 
QString::fromUtf8(qgetenv("PLASMA_PRELOAD_POLICY")).toLower();
  if (policy == QStringLiteral("aggressive")) {
  return Aggressive;
  } else if (policy == QStringLiteral("none")) {
  return None;
  }
  }
  return Adaptive;
  }();
  return preloadPolicy;
  }

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: anthonyfieroni, davidedmundson, broulik, apol, ngraham, plasma-devel, 
#frameworks, michaelh, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, 
abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-19 Thread Marco Martin
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit R242:6cbea20bf9f7: try to preload certain applets in a smart 
way (authored by mart).

REPOSITORY
  R242 Plasma Framework (Library)

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D10512?vs=27559=27561

REVISION DETAIL
  https://phabricator.kde.org/D10512

AFFECTED FILES
  src/plasma/data/servicetypes/plasma-applet.desktop
  src/plasmaquick/CMakeLists.txt
  src/plasmaquick/appletquickitem.cpp
  src/plasmaquick/private/appletquickitem_p.h

To: mart, #plasma
Cc: davidedmundson, broulik, apol, ngraham, plasma-devel, #frameworks, 
michaelh, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-19 Thread Marco Martin
mart updated this revision to Diff 27559.
mart added a comment.


  - just PLASMA_PRELOAD_POLICY

REPOSITORY
  R242 Plasma Framework (Library)

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D10512?vs=27558=27559

BRANCH
  arcpatch-D10512

REVISION DETAIL
  https://phabricator.kde.org/D10512

AFFECTED FILES
  src/plasma/data/servicetypes/plasma-applet.desktop
  src/plasmaquick/CMakeLists.txt
  src/plasmaquick/appletquickitem.cpp
  src/plasmaquick/private/appletquickitem_p.h

To: mart, #plasma
Cc: davidedmundson, broulik, apol, ngraham, plasma-devel, #frameworks, 
michaelh, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-19 Thread Marco Martin
mart updated this revision to Diff 27558.
mart added a comment.


  - always delay preloading

REPOSITORY
  R242 Plasma Framework (Library)

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D10512?vs=27557=27558

BRANCH
  arcpatch-D10512

REVISION DETAIL
  https://phabricator.kde.org/D10512

AFFECTED FILES
  src/plasma/data/servicetypes/plasma-applet.desktop
  src/plasmaquick/CMakeLists.txt
  src/plasmaquick/appletquickitem.cpp
  src/plasmaquick/private/appletquickitem_p.h

To: mart, #plasma
Cc: davidedmundson, broulik, apol, ngraham, plasma-devel, #frameworks, 
michaelh, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-19 Thread Marco Martin
mart added a comment.


  In D10512#209679 , @ngraham wrote:
  
  > If by default this slows down plasmashell's loading in favor of making 
widgets load faster, I'm against it. People will notice the drawbacks of the 
former more than the benefits of the latter.
  
  
  with the trick of the QTimer,  it shows an usable desktop actually before 
things are preloaded, then starting doing its things in the background.
  thesting on the local systems, plasma seems to stay fluid even while it's 
actually performing the preload in the background, so shouldn't be noticeable 
there.
  of course, needs to be tried by many people with systems more or less 
performant

INLINE COMMENTS

> broulik wrote in appletquickitem.cpp:55
> Cache the result in a static to read it only once?

in a static?

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: davidedmundson, broulik, apol, ngraham, plasma-devel, #frameworks, 
michaelh, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-19 Thread Nathaniel Graham
ngraham added a comment.


  If by default this slows down plasmashell's loading in favor of making 
widgets load faster, I'm against it. People will notice the drawbacks of the 
former more than the benefits of the latter.

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: davidedmundson, broulik, apol, ngraham, plasma-devel, #frameworks, 
michaelh, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-19 Thread Kai Uwe Broulik
broulik added a comment.


  lgtm

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: davidedmundson, broulik, apol, ngraham, plasma-devel, #frameworks, 
michaelh, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-19 Thread Marco Martin
mart updated this revision to Diff 27557.
mart added a comment.


  - cache env var reading

REPOSITORY
  R242 Plasma Framework (Library)

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D10512?vs=27554=27557

BRANCH
  arcpatch-D10512

REVISION DETAIL
  https://phabricator.kde.org/D10512

AFFECTED FILES
  src/plasma/data/servicetypes/plasma-applet.desktop
  src/plasmaquick/CMakeLists.txt
  src/plasmaquick/appletquickitem.cpp
  src/plasmaquick/private/appletquickitem_p.h

To: mart, #plasma
Cc: davidedmundson, broulik, apol, ngraham, plasma-devel, #frameworks, 
michaelh, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-19 Thread Kai Uwe Broulik
broulik added inline comments.

INLINE COMMENTS

> appletquickitem.cpp:55
>  {
> +if (qEnvironmentVariableIsSet("KDE_PLASMA_PRELOAD_POLICY")) {
> +const QByteArray policy = qgetenv("KDE_PLASMA_PRELOAD_POLICY");

Cache the result in a static to read it only once?

> appletquickitem.cpp:57
> +const QByteArray policy = qgetenv("KDE_PLASMA_PRELOAD_POLICY");
> +if (policy == "Aggressive") {
> +preloadPolicy = Aggressive;

case insensitive?

> appletquickitem.cpp:653
> +const int delay = qrand() % ((max + 1) - min) + min;
> +QTimer::singleShot(delay, [this, delay]() {
> +qCInfo(LOG_PLASMAQUICK) << "Delayed preload of " << 
> d->applet->title() << "after" << (qreal)delay/1000 << "seconds";

Still missing `this` context:

  QTimer::singleShot(delay, this, [this, delay]() {

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: davidedmundson, broulik, apol, ngraham, plasma-devel, #frameworks, 
michaelh, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-19 Thread Marco Martin
mart updated this revision to Diff 27554.
mart added a comment.


  control with an env variable
  
  can be either always off, always on or adaptive

REPOSITORY
  R242 Plasma Framework (Library)

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D10512?vs=27263=27554

BRANCH
  arcpatch-D10512

REVISION DETAIL
  https://phabricator.kde.org/D10512

AFFECTED FILES
  src/plasma/data/servicetypes/plasma-applet.desktop
  src/plasmaquick/CMakeLists.txt
  src/plasmaquick/appletquickitem.cpp
  src/plasmaquick/private/appletquickitem_p.h

To: mart, #plasma
Cc: davidedmundson, broulik, apol, ngraham, plasma-devel, #frameworks, 
michaelh, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-19 Thread David Edmundson
davidedmundson added inline comments.

INLINE COMMENTS

> appletquickitem.cpp:51
> +DefaultLauncherPreloadWeight = 100,
> +DelayedPreloadWeight = 25,
> +PreloadWeightIncrement = 5,

So by default we preload /everything/ then over time your session gets faster 
as you don't use stuff?

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: davidedmundson, broulik, apol, ngraham, plasma-devel, #frameworks, 
michaelh, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-15 Thread Marco Martin
mart updated this revision to Diff 27263.
mart added a comment.


  - less aggressive preload policy

REPOSITORY
  R242 Plasma Framework (Library)

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D10512?vs=27169=27263

BRANCH
  mart/preload

REVISION DETAIL
  https://phabricator.kde.org/D10512

AFFECTED FILES
  src/plasma/data/servicetypes/plasma-applet.desktop
  src/plasmaquick/CMakeLists.txt
  src/plasmaquick/appletquickitem.cpp
  src/plasmaquick/private/appletquickitem_p.h

To: mart, #plasma
Cc: davidedmundson, broulik, apol, ngraham, plasma-devel, #frameworks, 
michaelh, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, 
sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-15 Thread Marco Martin
mart added a comment.


  sooo, benchmarks:
  i tracked the time that occurs between mouse click and the return of 
setExpanded, which is reasonably near to the popup actually appearing (numbers 
consistent doing things more than once)
  this is done on a fairly fast machine, would be interesting to do the same on 
a really slow one, like the pinebook
  
  Kickoff: no preload, before incubator removal: 279 msecs
  Kickoff: no preload, after incubator removal: 211 msec
  Kickoff: with preload: 15 msecs (the first time still takes some tme to build 
all the nodes and texture, second time 0 msecs)
  
  digital clock (with akonadi integration which makes the graphics a bit more 
complex)
  digital clock: no preload, before incubator removal: 739 msecs
  digital clock, no preload , after incubator removal: 234 msecs
  digital clock, preload: 46 msecs (graphically quite complex, takes a more to 
create all textures, second time is 0 as usual)
  
  media player: no preload, before incubator removal: 148 msecs
  media player, no preload  , after incubator removal: 89 msec
  media player, preload: 0 msecs (graphics simple enough for texture creation 
to not register?)
  
  Clipboard, no preload ,  before incubator removal: 191 msec
  Clipboard, no preload ,  after incubator removal: 79 msec
  Clipboard, preload: 0 msec
  
  kicker: no preload, after incubator removal: 79 msecs
  kicker: preload: 9 msec

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: davidedmundson, broulik, apol, ngraham, plasma-devel, #frameworks, 
michaelh, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, 
sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-14 Thread Kai Uwe Broulik
broulik added inline comments.

INLINE COMMENTS

> appletquickitem.cpp:789
> +if (!d->applet->isContainment()) {
> +applet()->config().writeEntry(QStringLiteral("PreloadWeight"), 
> qMin(d->preloadWeight() + s_preloadWeightIncrement, 100));
> +}

I was also wondering about dbus-activated applet, from what I can tell whenever 
I start a media player, the score is reduced, so I'll most likely end up with 0 
for media controller immediately.

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: davidedmundson, broulik, apol, ngraham, plasma-devel, #frameworks, 
michaelh, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, 
sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-14 Thread David Edmundson
davidedmundson added inline comments.

INLINE COMMENTS

> appletquickitem.cpp:789
> +if (!d->applet->isContainment()) {
> +applet()->config().writeEntry(QStringLiteral("PreloadWeight"), 
> qMin(d->preloadWeight() + s_preloadWeigthIncrement, 100));
> +}

So if you ever open the any applet slightly more than every alternate login (at 
any point during that session) over time it'll become blocking preloaded on 
boot?

Your login to desktop will just get slower and slower until it's ultimately 
loading everything.

---

I'm against doing any hacks without prior profiling.

If we find plasma-pa (for example) gains a lot at no cost, great! Add the entry.

If we find plasma-pa loaded in a nanosecond anyway, and takes up 10Mb of RAM to 
do so, then it's a very silly thing to do.

I'd like to see some numbers for every applet we add it to, I don't think the 
shell is in a position to do this automatically.

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: davidedmundson, broulik, apol, ngraham, plasma-devel, #frameworks, 
michaelh, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, 
sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-14 Thread Nathaniel Graham
ngraham added a comment.


  Let's keep in mind the PR aspect of this: if we end up 30 MB heavier and a 
few seconds slower on a cold boot for a new install, advanced users who 
frequent internet forums and write reviews will notice this, but they probably 
won't notice that some widgets open more quickly once Plasma is loaded.
  
  Perhaps we could invert the logic: instead of preloading everything and then 
over time removing infrequently used widgets from the list, we could preload 
only a few fixed things like the menu, Task Manager, and plasma-nm, and for 
everything else, prelaod based on frequency of use.

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: broulik, apol, ngraham, plasma-devel, #frameworks, michaelh, ZrenBot, 
progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-14 Thread Marco Martin
mart added inline comments.

INLINE COMMENTS

> apol wrote in appletquickitem.cpp:87
> Isn't X-Plasma-PreloadWeight for that?

It's to have some default weights without having to populate every desktop file

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: broulik, apol, ngraham, plasma-devel, #frameworks, michaelh, ZrenBot, 
progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-14 Thread Kai Uwe Broulik
broulik added a comment.


  Cool!
  
  Since this is all applet quick item stuff it will just work™ with applet 
within system tray?
  Would be nice to have some `qCInfo` in there somewhere so we can better 
understand what it's doing, when it's increasing/decreasing the rating, when 
it's preloading it, etc.

INLINE COMMENTS

> appletquickitem.cpp:47
> +//weight values for the logic for when or if to preload
> +static const int s_defaultPreloadWeight = 50;
> +static const int s_defaultLauncherPreloadWeight = 100;

imho using an `enum` rather than a bunch of `static int`s is nicer

> appletquickitem.cpp:49
> +static const int s_defaultLauncherPreloadWeight = 100;
> +static const int s_defaultDatePreloadWeight = 80;
> +static const int s_immediatePreloadWeight = 70;

Are you sure we want to preload the calendar right away? This thing takes 
forever to open, wouldn't want to have that slow down plasma startup massively.

> appletquickitem.cpp:95
> +//default widgets to be barely preloaded
> +return qBound(0, 
> applet->config().readEntry(QStringLiteral("PreloadWeight"), 
> qMax(defaultWeight, 
> applet->pluginMetaData().rawData().value(QStringLiteral("X-Plasma-PreloadWeight")).toInt())),
>  100);
> +}

Could this be split into multiple lines, it's quite hard to follow

> appletquickitem.cpp:636
> +//decrease weight until we open it again
> +applet()->config().writeEntry(QStringLiteral("PreloadWeight"), qMax(0, 
> preloadWeight - s_preloadWeightIncrement));
> +

This should go into a function, there's like three places where a "random" 
`writeEntry` is scattered around

> appletquickitem.cpp:642
> +//spread the creation over a random delay between 2 and 10 seconds, 
> to make it look plasma started before, and load everything in the background 
> without big noticeable freezes
> +QTimer::singleShot(qrand() % ((1 + 1) - 2000) + 2000, [this]() {
> +d->createFullRepresentationItem();

Add `this` as context or else it would blow up when the applet is destroyed 
before the timer fires:

  QTimer::singleShot(qrand..., this, [this]() {

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: broulik, apol, ngraham, plasma-devel, #frameworks, michaelh, ZrenBot, 
progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-14 Thread Aleix Pol Gonzalez
apol added a comment.


  It sounds like it should be the shell who decides what needs preloading, 
rather than the framework guessing it.

INLINE COMMENTS

> appletquickitem.cpp:87
> +//some applet types we want a bigger weight
> +if (provides.contains(QStringLiteral("org.kde.plasma.launchermenu"))) {
> +defaultWeight = s_defaultLauncherPreloadWeight;

Isn't X-Plasma-PreloadWeight for that?

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D10512

To: mart, #plasma
Cc: apol, ngraham, plasma-devel, #frameworks, michaelh, ZrenBot, progwolff, 
lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, mart


D10512: try to preload certain applets in a smart way

2018-02-14 Thread Marco Martin
mart updated this revision to Diff 27169.
mart added a comment.


  - correct typo

REPOSITORY
  R242 Plasma Framework (Library)

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D10512?vs=27163=27169

BRANCH
  mart/preload

REVISION DETAIL
  https://phabricator.kde.org/D10512

AFFECTED FILES
  src/plasma/data/servicetypes/plasma-applet.desktop
  src/plasmaquick/appletquickitem.cpp
  src/plasmaquick/private/appletquickitem_p.h

To: mart, #plasma
Cc: plasma-devel, #frameworks, michaelh, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D10512: try to preload certain applets in a smart way

2018-02-14 Thread Marco Martin
mart updated this revision to Diff 27163.
mart added a comment.


  - silence warnings

REPOSITORY
  R242 Plasma Framework (Library)

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D10512?vs=27162=27163

BRANCH
  mart/preload

REVISION DETAIL
  https://phabricator.kde.org/D10512

AFFECTED FILES
  src/plasma/data/servicetypes/plasma-applet.desktop
  src/plasmaquick/appletquickitem.cpp
  src/plasmaquick/private/appletquickitem_p.h

To: mart, #plasma
Cc: plasma-devel, #frameworks, michaelh, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D10512: try to preload certain applets in a smart way

2018-02-14 Thread Marco Martin
mart created this revision.
mart added a reviewer: Plasma.
Restricted Application added projects: Plasma, Frameworks.
Restricted Application added subscribers: Frameworks, plasma-devel.
mart requested review of this revision.

REVISION SUMMARY
  preload popups of some applets after init in the background
  based on a value of X-Plasma-PreloadWeight in the desktop file
  if present, otherwise some default values based on the applet
  type (Provides)
  
  Save the weight in the config, if an applet is never opened,
  slowly decrease the weight, when it reaches 0 don't preload it
  next start, increase every time it gets opened, so at the moment
  it's quite aggressive about preloading, in order to not do it
  a lot of plasma startups without touching the applet are needed
  
  Applet with a very big weigth will be preloaded immediately,
  therefore having an impact on the time it will take to have
  a panel visible and usable, while lesser weigths will preload
  after a random number of seconds between 2 and 10, so will load
  in the background after everything is started

TEST PLAN
  Plasma starts up correctly, applets load correctly and can be added
  correctly both those expanded or collapsed.
  plasmashell appears correctly usable without too big hiccups even
  while it's loading things in the background
  
  some numbers:
  without preloading, plasma takes around 64 mb of memory after startup
  when preloading everything about 94, so it's a cost of about 30 mb
  which is not negligible.
  don't have precise timing, but if everything gets preloaded immediately,
  the time to get an usable desktop appears to be at least doubled,
  while the delayed preloading (except just a couple of applets) doesn't
  seem to have a big impact on the time needed to get an usable desktop

REPOSITORY
  R242 Plasma Framework (Library)

BRANCH
  mart/preload

REVISION DETAIL
  https://phabricator.kde.org/D10512

AFFECTED FILES
  src/plasma/data/servicetypes/plasma-applet.desktop
  src/plasmaquick/appletquickitem.cpp
  src/plasmaquick/private/appletquickitem_p.h

To: mart, #plasma
Cc: plasma-devel, #frameworks, michaelh, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart