Page MenuHomeSoftware Heritage

cli: speedup the `swh` cli command startup time
ClosedPublic

Authored by douardda on Sep 10 2020, 4:24 PM.

Details

Summary

by moving import statements in functions and using conditional
import of typechecking modules (especially swh.storage.interface
which triggers the loading of 300+ modules).

Related to T2575.

Diff Detail

Event Timeline

Build is green

Patch application report for D3920 (id=13780)

Rebasing onto 8d6e18d3a3...

Current branch diff-target is up to date.
Changes applied before test
commit b78087700a6f6e04a36c414e1a958277f515a735
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Sep 10 12:28:01 2020 +0200

    cli: speedup the `swh` cli command startup time
    
    by moving import statements in functions and using conditional
    import of typechecking modules (especially swh.storage.interface
    which triggers the loading of 300+ modules).
    
    Related to T2575.

See https://jenkins.softwareheritage.org/job/DSEA/job/tests-on-diff/37/ for more details.

vlorentz added inline comments.
swh/search/__init__.py
24–26

strings (see comment in the other diff)

use strin annotations as suggested by vlorent

same *with* the file in the commit --amend

Build is green

Patch application report for D3920 (id=13809)

Rebasing onto 8d6e18d3a3...

Current branch diff-target is up to date.
Changes applied before test
commit 762c453c7055fa290f0bdd8be2fe0945eb49dad0
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Sep 10 12:28:01 2020 +0200

    cli: speedup the `swh` cli command startup time
    
    by moving import statements in functions and using conditional
    import of typechecking modules (especially swh.storage.interface
    which triggers the loading of 300+ modules).
    
    Related to T2575.

See https://jenkins.softwareheritage.org/job/DSEA/job/tests-on-diff/38/ for more details.

Build is green

Patch application report for D3920 (id=13810)

Rebasing onto 8d6e18d3a3...

Current branch diff-target is up to date.
Changes applied before test
commit c9c58a634a341817b2e9ef0015067120358d1b76
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Sep 10 12:28:01 2020 +0200

    cli: speedup the `swh` cli command startup time
    
    by moving import statements in functions and using conditional
    import of typechecking modules (especially swh.storage.interface
    which triggers the loading of 300+ modules).
    
    Related to T2575.

See https://jenkins.softwareheritage.org/job/DSEA/job/tests-on-diff/39/ for more details.

This revision is now accepted and ready to land.Sep 10 2020, 6:47 PM