Page MenuHomeSoftware Heritage

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

Authored by douardda on Thu, Sep 10, 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

Repository
rDSEA Archive search
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

douardda created this revision.Thu, Sep 10, 4:24 PM

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–25

strings (see comment in the other diff)

douardda updated this revision to Diff 13809.Thu, Sep 10, 5:34 PM

use strin annotations as suggested by vlorent

douardda updated this revision to Diff 13810.Thu, Sep 10, 5:35 PM

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.

vlorentz accepted this revision.Thu, Sep 10, 6:47 PM
This revision is now accepted and ready to land.Thu, Sep 10, 6:47 PM
This revision was automatically updated to reflect the committed changes.