Commit c9c93943 authored by Robert Bradshaw's avatar Robert Bradshaw

More utility code caching.

parent 108ab86b
......@@ -318,6 +318,8 @@ class ContentHashingUtilityCode(UtilityCode):
return hash((self.proto, self.impl))
def __eq__(self, other):
if self is other:
return True
if not isinstance(other, type(self)):
return False
......
......@@ -32,8 +32,11 @@ try:
except ImportError:
basestring = str # Python 3
_utility_cache = {}
def load_c_utility(name):
return ContentHashingUtilityCode.load(name, "Optimize.c")
if name not in _utility_cache:
_utility_cache[name] = ContentHashingUtilityCode.load(name, "Optimize.c")
return _utility_cache[name]
class FakePythonEnv(object):
"A fake environment for creating type test nodes etc."
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment