##// END OF EJS Templates
util: make nogc effective for CPython...
Jun Wu -
r33796:05264fc9 default
parent child Browse files
Show More
@@ -964,10 +964,9 b' def nogc(func):'
964 into. As a workaround, disable GC while building complex (huge)
964 into. As a workaround, disable GC while building complex (huge)
965 containers.
965 containers.
966
966
967 This garbage collector issue have been fixed in 2.7.
967 This garbage collector issue have been fixed in 2.7. But it still affect
968 CPython's performance.
968 """
969 """
969 if sys.version_info >= (2, 7):
970 return func
971 def wrapper(*args, **kwargs):
970 def wrapper(*args, **kwargs):
972 gcenabled = gc.isenabled()
971 gcenabled = gc.isenabled()
973 gc.disable()
972 gc.disable()
@@ -978,6 +977,10 b' def nogc(func):'
978 gc.enable()
977 gc.enable()
979 return wrapper
978 return wrapper
980
979
980 if pycompat.ispypy:
981 # PyPy runs slower with gc disabled
982 nogc = lambda x: x
983
981 def pathto(root, n1, n2):
984 def pathto(root, n1, n2):
982 '''return the relative path from one place to another.
985 '''return the relative path from one place to another.
983 root should use os.sep to separate directories
986 root should use os.sep to separate directories
General Comments 0
You need to be logged in to leave comments. Login now