Author terry.reedy
Recipients pablogsal, shihai1991, terry.reedy, vstinner, zach.ware
Date 2020-09-05.00:24:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1599265443.84.0.745648554277.issue41718@roundup.psfhosted.org>
In-reply-to
Content
On Windows with current master, the baseline for running anything with 1 import (">>>  import sys; len(sys.modules)") is 35 imported modules.  Adding "import unittest" increases this to 80.  What slightly puzzles me is that running 
---
import unittest
import sys

class Tests(unittest.TestCase):
    def test_bug(self):
        print("len(sys.modules):", len(sys.modules))

if __name__ == "__main__":
    unittest.main()
---
increases the number to 90.  Perhaps unittest has delayed imports.

The current startup number for IDLE is 162, which can result in a cold startup of several seconds.  I am thinking of trying to reduce this by delaying imports of modules that are not immediately used and might never be used.

For tests, I gather that side-effect issues are more important than startup time.
History
Date User Action Args
2020-09-05 00:24:03terry.reedysetrecipients: + terry.reedy, vstinner, zach.ware, pablogsal, shihai1991
2020-09-05 00:24:03terry.reedysetmessageid: <1599265443.84.0.745648554277.issue41718@roundup.psfhosted.org>
2020-09-05 00:24:03terry.reedylinkissue41718 messages
2020-09-05 00:24:03terry.reedycreate