[PATCH] faster initial commit due to buffered logging

Ian Clatworthy ian.clatworthy at internode.on.net
Mon May 28 12:59:39 BST 2007


Robert Collins wrote:
> On Mon, 2007-05-28 at 21:05 +1000, Ian Clatworthy wrote:
>   
>> The attached patch builds on the previous submitted one and includes 
>> better comments in response to feedback from Andrew Bennetts. The main 
>> improvement though is "smarter" logging in that the "added ..." messages 
>> are output at the end, not in situ. To be strictly correct, the add 
>> messages are buffered until an 'interesting' one (like 'Committed 
>> revision xx.') is logged.
>>     
>
> Would a simpler approach be to write to stdout rather than stderr ?
> Thats buffered by default, and we dont need to create our own buffering
> mechanism.
>
> -Rob
>   
Rob,

I don't believe stderr vs stdout is the issue - it's ~/.bzr.log. When I 
replaced the call to bzrlib.note with sys.stderr.write, the performance 
increase was dramatic leading me to the patch submitted. Writing to 
sys.stdout might be slightly faster again but either way, dropping the 
logging to ~/.bzr.log is a "semantic" change I was hoping to avoid. By 
simply caching the 'added' messages, all the writes to ~/.bzr.log happen 
at once. The other nice thing about buffering the add messages is that 
the progress bar is actually useful now.

My main concern with buffering was the memory impact. Even with 50k 
files, it doesn't make much difference. That's more a reflection on the 
need to improve commit's memory footprint though. :-(

Ian C.



More information about the bazaar mailing list