aboutsummaryrefslogtreecommitdiff
path: root/tools/shared.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-11-21 10:52:58 +0100
committerAlon Zakai <alonzakai@gmail.com>2012-11-21 20:47:02 +0100
commit3a048d9e5856ae9b2945c158ff43c1c35857a919 (patch)
tree3ec3278edc57c5e6175639ec022e2c1808d3a335 /tools/shared.py
parent6f679ca7e71e881a8ee23ae3c8cb163c090f256f (diff)
cache emscript function chunks
Diffstat (limited to 'tools/shared.py')
-rw-r--r--tools/shared.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/shared.py b/tools/shared.py
index 8cbafcfa..0f22bb8c 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -1182,8 +1182,11 @@ class JCache:
# Returns a cached value, if it exists. Make sure the full key matches
@staticmethod
def get(shortkey, keys):
+ #if DEBUG: print >> sys.stderr, 'jcache get?'
cachename = JCache.get_cachename(shortkey)
- if not os.path.exists(cachename): return
+ if not os.path.exists(cachename):
+ #if DEBUG: print >> sys.stderr, 'jcache none at all'
+ return
data = cPickle.Unpickler(open(cachename, 'rb')).load()
if len(data) != 2:
#if DEBUG: print >> sys.stderr, 'jcache error in get'
@@ -1233,7 +1236,7 @@ class JCache:
news.append(func)
else:
n = previous_mapping[ident]
- while n > len(chunks): chunks.append([])
+ while n >= len(chunks): chunks.append([])
chunks[n].append(func)
# add news and adjust for new sizes
spilled = news
@@ -1268,6 +1271,9 @@ class JCache:
chunks.append(curr)
curr = None
if chunking_file:
+ # sort within each chunk, to keep the order identical
+ for chunk in chunks:
+ chunk.sort(key=lambda func: func[0])
# save new mapping info
new_mapping = {}
for i in range(len(chunks)):