Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various improvements for startup performance #126

Merged
merged 26 commits into from
Nov 23, 2019
Merged

Conversation

karlch
Copy link
Owner

@karlch karlch commented Nov 23, 2019

Various little tweaks to work on startup performance:

  • Replace some python modules by the Qt equivalent
  • Lazier logic in logging and manipulate
  • fastentrypoints hack

Bugs found were fixed on the fly.

Ideas for further improvement:

  • Lazy initialization of thumbnail mode
  • Further import cleanup or even lazy imports, we still spend ~50 % of the startup time on imports

This allows to:
* Pass less arguments to the constructor
* Lazily create the expensive argument parser object
This command can be quite slow as it may start a git subprocess and is
not required in every run.
This saves some imports not required in a regular vimiv session.
This seems to be slightly faster than the QStackedLayout and also
cleaner as we add a widget to an existing layout, not a layout to a
layout.
This signal is emitted before a mode is entered the first time. This
makes it possible to initialize mode-related widgets, such as
manipulate, only upon first entering, not upon startup.
All manipulate related widgets are now only created upon the first
entering of manipulate mode. This speeds up startup.
This is where the commandline is located anyway and therefore cleans up
the dependencies slightly.
As the modes are globals of the module, the _entered attribute is not
reset after each end2end test.
This can easily be done using QDateTime and saves an import :)
Improves startup performance by delaying the initialization of all
completion models to the point when they are needed.
This makes it easy to run subprocesses using Qt instead of python and
should improve performance as we do not require the subprocess module.
The hack introduced in
d33d5b3
emitting aboutToQuit prematurely actually leads to it being emitted
twice. The better solution is to write in serial and handle the one
emitting correctly.
This removes the need of the python subprocess module and somewhat
cleans up the implementation. For general external commands with !, a
sub-shell is no longer spawned. This now only applies with the `:spawn`
command.
The actual module logger instances are now only created on an as-needed
basis. To avoid repetition in writing the log, debug, info, ...
functions some __setattr__ magic was used which may have to be
reconsidered.
* The conversion of QBytesArray to string is not recognized correctly
* Logger type has changed to LazyLogger
* External commands now expand *, ? and [abc] as expected using glob
  without requiring a sub-shell
* \char is used for escaping in paths, not the slightly cryptic [char]
  of glob
@karlch karlch merged commit 7a022f2 into master Nov 23, 2019
@karlch karlch deleted the startup_performance branch November 23, 2019 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant