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

[PREVIEW-WIP] PERF: Improve startup time by 8% with lazy loading of wrapped libraries #509

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jcfr
Copy link
Member

@jcfr jcfr commented May 31, 2016

*** WORK IN PROGRESS: For now, you have to make sure SlicerApp-real and
Slicer launcher are built to ensure the successful generation of the json
files ***

Startup time reduced from 3.8s to 3.5s with a "cold cache"
and from 2.7s to 2.38s with a "warm cache".

For each logic/mrml/dm/widgets python modules, a json files listing
the associated attributes is generated. Then, when the application is
initialized, the "slicer" module is created as a "lazy" module with
the attributes associated with logic/mrml/dm/widgets set as "not loaded".

Finally, as soon as an attribute not yet loaded is accessed, the specialized
__getattribute__ loads the associated python module and update the module
dictionary.

The "lazy" module has been adapted from "itkLazy.py"

Results have been gathered on Ubuntu 15.10 on a workstation with the
following specs: 64GB / M.2 PCIe NVMe SSD / Quad Core 3.80GHz

*** WORK IN PROGRESS: For now, you have to make sure SlicerApp-real and
Slicer launcher are built to ensure the successful generation of the json
files ***

Startup time reduced from 3.8s to 3.5s with a "cold cache"
and from 2.7s to 2.38s with a "warm cache".

For each logic/mrml/dm/widgets python modules, a json files listing
the associated attributes is generated. Then, when the application is
initialized, the "slicer" module is created as a "lazy" module with
the attributes associated with logic/mrml/dm/widgets set as "not loaded".

Finally, as soon as an attribute not yet loaded is accessed, the specialized
__getattribute__ loads the associated python module and update the module
dictionary.

The "lazy" module has been adapted from "itkLazy.py"

Results have been gathered on Ubuntu 15.10 on a workstation with the
following specs: 64GB / M.2 PCIe NVMe SSD / Quad Core 3.80GHz
@jcfr jcfr force-pushed the lazy-loading-of-python-wrapped-modules branch from c82c47d to 322809d Compare May 31, 2016 07:28
@jcfr
Copy link
Member Author

jcfr commented May 31, 2016

Note: Timing performance obtained after applying the fixes associated with #508

@pieper
Copy link
Member

pieper commented May 31, 2016

Today on the tcon it would help if we could discuss how to run these
performance tests on other platforms. Slicer on macs has always been
terribly slow to start so I suspect the tune ups will have even bigger
impact there. Also the Instruments tool on mac is good for finding hot
spots in the code.

On Tue, May 31, 2016 at 3:30 AM, Jean-Christophe Fillion-Robin <
[email protected]> wrote:

Note: Timing performance obtained after applying the fixes associated with
#508 Slicer/Slicer#508


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
Slicer/Slicer#509 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAHsfc-YH5TSmosRVSon3vIdfsqs1uJcks5qG-OIgaJpZM4IqP4t
.

@jcfr jcfr added the wip label Oct 12, 2016
@jcfr jcfr added wip and removed wip labels Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants