aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-11-22 15:15:00 +0100
committerAlon Zakai <alonzakai@gmail.com>2012-11-22 15:15:00 +0100
commit09c376afeea6c74642c57fa19b13f714d2189a01 (patch)
tree006457bf7b935a6a85d668d7b3403e3adb013b11 /tools
parentf725733b1475788559ff1862e7007559c5d550bc (diff)
fix ll func identifying for chunking purposes, and add testing of jcache on a large program
Diffstat (limited to 'tools')
-rw-r--r--tools/shared.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/shared.py b/tools/shared.py
index 6f14c078..7bafd51d 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -1180,7 +1180,7 @@ 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?'
+ #if DEBUG: print >> sys.stderr, 'jcache get?', shortkey
cachename = JCache.get_cachename(shortkey)
if not os.path.exists(cachename):
#if DEBUG: print >> sys.stderr, 'jcache none at all'
@@ -1205,6 +1205,10 @@ class JCache:
def set(shortkey, keys, value):
cachename = JCache.get_cachename(shortkey)
cPickle.Pickler(open(cachename, 'wb')).dump([keys, value])
+ #if DEBUG:
+ # for i in range(len(keys)):
+ # open(cachename + '.key' + str(i), 'w').write(keys[i])
+ # open(cachename + '.value', 'w').write(value)
# Given a set of functions of form (ident, text), and a preferred chunk size,
# generates a set of chunks for parallel processing and caching.
@@ -1279,6 +1283,13 @@ class JCache:
for ident, data in chunk:
new_mapping[ident] = i
cPickle.Pickler(open(chunking_file, 'wb')).dump(new_mapping)
+ #if DEBUG:
+ # if previous_mapping:
+ # for ident in set(previous_mapping.keys() + new_mapping.keys()):
+ # if previous_mapping.get(ident) != new_mapping.get(ident):
+ # print >> sys.stderr, 'mapping inconsistency', ident, previous_mapping.get(ident), new_mapping.get(ident)
+ # for key, value in new_mapping.iteritems():
+ # print >> sys.stderr, 'mapping:', key, value
return [''.join([func[1] for func in chunk]) for chunk in chunks] # remove function names
class JS: