[pypy-commit] pypy default: Add yet another layer of caching. This is useful when we have to merge
fijal
noreply at buildbot.pypy.org
Sat Dec 15 09:48:24 CET 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r59437:8117b7a66486
Date: 2012-12-15 10:48 +0200
http://bitbucket.org/pypy/pypy/changeset/8117b7a66486/
Log: Add yet another layer of caching. This is useful when we have to
merge a few direct calls way too often
diff --git a/pypy/translator/backendopt/graphanalyze.py b/pypy/translator/backendopt/graphanalyze.py
--- a/pypy/translator/backendopt/graphanalyze.py
+++ b/pypy/translator/backendopt/graphanalyze.py
@@ -8,6 +8,7 @@
def __init__(self, translator):
self.translator = translator
self.analyzed_calls = {}
+ self.analyzed_indirect_calls = {}
self.recursion_hit = False
# method overridden by subclasses
@@ -140,10 +141,16 @@
return result
def analyze_indirect_call(self, graphs, seen=None):
- results = []
- for graph in graphs:
- results.append(self.analyze_direct_call(graph, seen))
- return self.join_results(results)
+ graphs_t = tuple(graphs)
+ try:
+ return self.analyzed_indirect_calls[graphs_t]
+ except KeyError:
+ results = []
+ for graph in graphs:
+ results.append(self.analyze_direct_call(graph, seen))
+ res = self.join_results(results)
+ self.analyzed_indirect_calls[graphs_t] = res
+ return res
def analyze_oosend(self, TYPE, name, seen=None):
graphs = TYPE._lookup_graphs(name)
More information about the pypy-commit
mailing list