bug? find_branches or find_bzrdir tries to open all files as bzr locations

Alexander Belchenko bialix at ukr.net
Wed May 18 05:12:42 UTC 2011


18.05.2011 1:18, Jelmer Vernooij пишет:
> On Wed, 2011-05-18 at 01:02 +0300, Alexander Belchenko wrote:
>> 17.05.2011 23:53, Aaron Bentley пишет:
>>> On 11-05-16 04:48 AM, Alexander Belchenko wrote:
>>>> `bzr qlog` without any parameters run inside shared repository is trying
>>>> to detect all available branches and show log for all of them. And often
>>>> it has very slow start with many branches with many files.
>>>
>>>> So, I think it could perform better for local filesystem if it will skip
>>>> plain files. Perhaps symlinks should be inspected as well as
>>>> directories, I don't know.
>>>
>>> I'm going to assume two things:
>>> 1. when we list files, we don't get their filetype
>>> 2. statting a file to determine its filetype takes roughly the same
>>> amount of time as a failed attempt to open ".bzr/branch-format" where
>>> ".bzr" is a file.
>>>
>>> If those assumptions are true, the fastest thing we can do is attempt to
>>> open .bzr/branch-format.  Testing the filetype would introduce and extra
>>> filesystem call, which would be slower.
>>
>> If I understand correctly, when bzr tries to find branch then it tries
>> to open location with all registered (supported) branch formats.
>> So, if first attempt (with first or default registered format) to open
>> branch has failed then bzr tries to open the location with next
>> format, right? Plus foreign-vcs plugins add more branch formats that
>> also should be checked.
>>
>> If this is correct then for every directory/files/symlink bzr will try
>> to open branch several times, therefore doing many syscalls every
>> time. Is it correct?
> Bzr only tries to open the .bzr/branchformat file and if it can, it
> reads the contents and looks them up in the BranchFormat registry. So a
> new bzr branch format does not in any way add to the performance of
> find_branches.
> 
>> As I can see there are 6 branch formats registered in bzr 2.3 codebase:
>>
>> BranchFormat.register_format(__format5)
>> BranchFormat.register_format(BranchReferenceFormat())
>> BranchFormat.register_format(__format6)
>> BranchFormat.register_format(__format7)
>> BranchFormat.register_format(__format8)
>> BranchFormat.set_default_format(__format7)
>> _legacy_formats = [BzrBranchFormat4(),
>>     ]
>> network_format_registry.register(
>>     _legacy_formats[0].network_name(), _legacy_formats[0].__class__)
> The only thing that's relevant is the number of probers that's
> registered in bzrlib.controldir. bzr itself registers a single prober
> for .bzr/branch-format and a single prober for opening remote branches.
> The foreign format plugins also each register a single prober.

OK, sorry, I'm wrong then.

-- 
All the dude wanted was his rug back



More information about the bazaar mailing list