RFC: startup time - again
Matt Nordhoff
mnordhoff at mattnordhoff.com
Tue Sep 9 18:24:54 BST 2008
John Arbash Meinel wrote:
> David Cournapeau wrote:
>> John Arbash Meinel wrote:
>>> Fixing import times tends to be Whack-a-mole because making one module
>>> lazily import things it doesn't need, just shows another one in the
>>> chain that *does the same thing*.
>> Yes, I know it is quite frustrating, and not so easy to fix in python.
>> It takes quite some time to get to a certain stage, and it takes one
>> line to get back to square one.
>
>> Going back to hg vs bzr, are the mechanisms for lazy import in hg and
>> bzr vastly different ? Or the difference mostly lies in some modules
>> that bzr depends on and hg does not ?
>
>> cheers,
>
>> David
>
>
> hg doesn't have the level of abstraction that bzr does. They pretty much
> only support 1 repository layout (2 if you count the old 'revlog' versus
> 'revlog-ng' stuff.)
>
> The basic lazy import mechanism is similar, though the syntax is
> different. (I wrote lazy_import to allow you to use standard python
> syntax, they use a custom syntax.)
>
> There are some other, mostly minor, things.
That's no longer the case. Nowadays, they override the __import__
function, so there's no special syntax whatsoever, and everything gets
imported lazily (except for half a dozen modules on an ignore list).
(Look at mercurial/demandimport.py [1] in the source tree if you're
curious. It replaced the old mercurial/demandload.py in version 0.9.4.)
> Oh, and by default they don't load plugins unless users explicitly
> update their 'hgrc' files. So installing a plugin doesn't make it
> available until a user does something manually.
>
> John
> =:->
[1]
<http://hg.intevation.org/mercurial/crew/file/tip/mercurial/demandimport.py?style=gitweb>
--
More information about the bazaar
mailing list