mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-29585: optimize site.py startup time (GH-136)
Avoid importing `sysconfig` from `site` by copying minimum code. Python startup is 5% faster on Linux and 30% faster on macOS
This commit is contained in:
parent
79d37ae979
commit
a8f8d5b4bd
8 changed files with 96 additions and 43 deletions
|
@ -180,6 +180,13 @@ class HelperFunctionsTests(unittest.TestCase):
|
|||
finally:
|
||||
pth_file.cleanup()
|
||||
|
||||
def test_getuserbase(self):
|
||||
self.assertEqual(site._getuserbase(), sysconfig._getuserbase())
|
||||
|
||||
def test_get_path(self):
|
||||
self.assertEqual(site._get_path(site._getuserbase()),
|
||||
sysconfig.get_path('purelib', os.name + '_user'))
|
||||
|
||||
@unittest.skipUnless(site.ENABLE_USER_SITE, "requires access to PEP 370 "
|
||||
"user-site (site.ENABLE_USER_SITE)")
|
||||
def test_s_option(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue