HomePhabricator

files: speed up `hg files` when no flags change display

Description

files: speed up hg files when no flags change display

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.

Differential Revision: https://phab.mercurial-scm.org/D8586