mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 16:31:02 +03:00
ui: cache a progress config check
Summary: During profiling of the `hg sparse --refresh` command, I discovered significant time spent in producing the progress bar. At first I was skeptical, but then I commented out the progress line and the command took half as long! I started looking for micro-optiization opportunities. Differential Revision: D7210617 fbshipit-source-id: 17a11ae572fee48e6d8db33ca75843be0ec2e850
This commit is contained in:
parent
7c94c47d99
commit
4a02cd42df
@ -1533,6 +1533,7 @@ class ui(object):
|
||||
@util.propertycache
|
||||
def _progbar(self):
|
||||
"""setup the progbar singleton to the ui object"""
|
||||
self._progdebug = self.configbool('progress', 'debug')
|
||||
if (self.quiet or self.debugflag
|
||||
or self.configbool('progress', 'disable')
|
||||
or not progress.shouldprint(self)):
|
||||
@ -1564,7 +1565,7 @@ class ui(object):
|
||||
if self._progbar is not None:
|
||||
self._progbar.progress(topic, pos, item=item, unit=unit,
|
||||
total=total)
|
||||
if pos is None or not self.configbool('progress', 'debug'):
|
||||
if pos is None or not self._progdebug:
|
||||
return
|
||||
|
||||
if unit:
|
||||
|
Loading…
Reference in New Issue
Block a user