It's not the first time I see slowness from this command slow down
tools built on top of hg.
The majority of the time is spent merely printing the result before
this change, which is clearly not how it should be (especially since
the computation of the result also looks slow).
Running hg files in mozilla-central:
parent revision: 1,260s
this commit: 0,683s
this commit without batching ui.write: 0,931s
this commit replacing the body of the loop with pass: 0,566s
This looks like a prime candidate for a rust fast path, but until
then, it seems reasonable to optimize the python.
The normal idiom for batches uses a list and a single join at time of writing. Not sure if there are repositories where we care about the size of the temporary buffer enough to flush it in the middle.