sys.stderr very slow
John Arbash Meinel
john at arbash-meinel.com
Fri Nov 10 15:54:23 GMT 2006
Martin Pool wrote:
> On 2 Nov 2006, John Arbash Meinel <john at arbash-meinel.com> wrote:
>> It seems that writing to sys.stderr is much slower than at least I
>> thought it would be.
>
> That's interesting to know.
>
>> Now, this was using the "DotsProgressBar" which effectively calls
>> sys.stderr.write('.') for every update() call. I thought the penalty is
>> because sys.stderr is unbuffered, so it forces a flush on every write,
>> which updates the screen, etc. (Though in this case it was re-directed
>> to a file).
>
> Should we just remove (or not use) DotsProgressBar then? If there's no terminal, or
> not enough of one to draw a progress bar then there's a good chance
> there's no user watching, or that they won't be able to see the output.
>
> Anyhow, +1 for your patch if you want it.
>
Well, if you merge my other patch (the progress bar changes). It removes
the nested progress bar as part of KnitIndex.__init__ Which means that
we have a lot fewer ticks(), and helps a lot more than these changes.
I think TTYProgressBar actually writes less data to the screen than
DotsProgressBar because of the built-in throttling which suppresses text
rather than what I did to just buffer it for later.
Apparently creating 80K KnitIndexes which each write 3 dots to the
screen is a lot more overhead than we might expect.
I did the work, so I think we might as well merge it. Thanks for the review.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061110/7d6d5f74/attachment.pgp
More information about the bazaar
mailing list