[MERGE] Various hackery to reduce startup time.

Matt Nordhoff mnordhoff at mattnordhoff.com
Fri Sep 12 08:05:06 BST 2008


Andrew Bennetts wrote:
> This is that “faster-startup” branch I've been talking about.
> 
> Here's a summary of what it does... not all of it is necessarily a good idea, or
> well-executed:
> 
>   - earlier installation of lazy_regex
>   - many dead imports removed
>   - many imports made lazy (probably more than is usefuL)
>   - some imports made *not* lazy! (because it's a waste of effort if they are
>     going to be always used)
>   - bzrlib.user_encoding completely removed (bzrlib.osutils.get_user_encoding
>     was already preferred), which makes a bare "import bzrlib" lighter-weight.
>   - avoid importing modules we only use for win32 (e.g. ctypes, win32utils) on
>     non-win32 platforms
>   - a few contortions to avoid necessarily importing sha, ConfigObj
>   - add lazy_registry to RegistryOption
>   - use properties for _serializer attributes of various RepositoryFormats so
>     that xml5/6/7/8 modules aren't always loaded
>   - moved a private function from bzrlib.diff to bzrlib.status so that the
>     latter doesn't need to import the former.
>   - prevent configobj from importing compiler, we don't need the 'unrepr'
>     feature of configobj that uses that module.
> 
> See the diff for the gory details.
> 
> -Andrew.

Nit:

> === modified file 'bzrlib/tests/test_osutils_encodings.py'
> --- bzrlib/tests/test_osutils_encodings.py	2008-05-05 17:02:02 +0000
> +++ bzrlib/tests/test_osutils_encodings.py	2008-09-08 12:59:00 +0000

> @@ -119,7 +118,7 @@
>          self.assertEqual('stdin_encoding', osutils.get_terminal_encoding())
>  
>          sys.stdin.encoding = None
> -        # and in the worst case, use bzrlib.user_encoding
> +        # and in the worst case, use osutils.get_user_encoding()
>          self.assertEqual('user_encoding', osutils.get_terminal_encoding())
>  
>      def test_terminal_cp0(self):

The comment refers to get_user_encoding, but the code uses
get_terminal_encoding.
-- 



More information about the bazaar mailing list