Patchwork D402: util: make nogc effective for CPython

login
register
mail settings
Submitter phabricator
Date Aug. 15, 2017, 7:42 a.m.
Message ID <2b482fee679f34e0554e2cbc4835771d@localhost.localdomain>
Download mbox | patch
Permalink /patch/23017/
State Not Applicable
Headers show

Comments

phabricator - Aug. 15, 2017, 7:42 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG05264fc9d8d6: util: make nogc effective for CPython (authored by quark).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D402?vs=909&id=924

REVISION DETAIL
  https://phab.mercurial-scm.org/D402

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS




To: quark, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -964,10 +964,9 @@ 
     into. As a workaround, disable GC while building complex (huge)
     containers.
 
-    This garbage collector issue have been fixed in 2.7.
+    This garbage collector issue have been fixed in 2.7. But it still affect
+    CPython's performance.
     """
-    if sys.version_info >= (2, 7):
-        return func
     def wrapper(*args, **kwargs):
         gcenabled = gc.isenabled()
         gc.disable()
@@ -978,6 +977,10 @@ 
                 gc.enable()
     return wrapper
 
+if pycompat.ispypy:
+    # PyPy runs slower with gc disabled
+    nogc = lambda x: x
+
 def pathto(root, n1, n2):
     '''return the relative path from one place to another.
     root should use os.sep to separate directories