diff hgext/highlight/highlight.py @ 37843:670eb4fa1b86

demandimport: make module ignores a set (API) The list of modules to ignore is used for membership testing. Yet it is defined as a list. Sets are more efficient for membership testing. So this commit converts the module list to a set. Since we took an API hit, I renamed the variable to further clarify the change. This appears to reduce the CPU time for running 300 invocations of `hg log -r. -T '{rev}'` on my i7-6700K: before: 18.64s after: 18.44s Differential Revision: https://phab.mercurial-scm.org/D3440
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 05 May 2018 18:41:51 -0700
parents f0b6fbea00cf
children 876352ea831e
line wrap: on
line diff
--- a/hgext/highlight/highlight.py	Thu Apr 19 20:33:43 2018 +0900
+++ b/hgext/highlight/highlight.py	Sat May 05 18:41:51 2018 -0700
@@ -11,7 +11,7 @@
 from __future__ import absolute_import
 
 from mercurial import demandimport
-demandimport.ignore.extend(['pkgutil', 'pkg_resources', '__main__'])
+demandimport.IGNORES.update(['pkgutil', 'pkg_resources', '__main__'])
 
 from mercurial import (
     encoding,