##// END OF EJS Templates
progress: avoid ui.configbool() lookup when progress bar is active...
Gregory Szorc -
r41093:6603de28 default
parent child Browse files
Show More
@@ -104,6 +104,8 b' class progbar(object):'
104 self.order = self.ui.configlist('progress', 'format')
104 self.order = self.ui.configlist('progress', 'format')
105 self.estimateinterval = self.ui.configwith(
105 self.estimateinterval = self.ui.configwith(
106 float, 'progress', 'estimateinterval')
106 float, 'progress', 'estimateinterval')
107 # developer config: progress.debug
108 self.debug = self.ui.configbool('progress', 'debug')
107
109
108 def show(self, now, topic, pos, item, unit, total):
110 def show(self, now, topic, pos, item, unit, total):
109 if not shouldprint(self.ui):
111 if not shouldprint(self.ui):
@@ -1702,6 +1702,14 b' class ui(object):'
1702 elif self._progbar is not None:
1702 elif self._progbar is not None:
1703 self._progbar.progress(topic, pos, item=item, unit=unit,
1703 self._progbar.progress(topic, pos, item=item, unit=unit,
1704 total=total)
1704 total=total)
1705
1706 # Looking up progress.debug in tight loops is expensive. The value
1707 # is cached on the progbar object and we can avoid the lookup in
1708 # the common case where a progbar is active.
1709 if pos is None or not self._progbar.debug:
1710 return
1711
1712 # Keep this logic in sync with above.
1705 if pos is None or not self.configbool('progress', 'debug'):
1713 if pos is None or not self.configbool('progress', 'debug'):
1706 return
1714 return
1707
1715
General Comments 0
You need to be logged in to leave comments. Login now