aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-11-20 21:32:22 +0100
committerAlon Zakai <alonzakai@gmail.com>2012-11-21 20:47:02 +0100
commit6f679ca7e71e881a8ee23ae3c8cb163c090f256f (patch)
treebe20ffd67f8d165a2be5c0f35623a46a1d52f6cd
parent46277d084c21ff169716f556c9153fe41f4aa168 (diff)
return chunks of text in chunkify to simplify the ap-iy
-rwxr-xr-xemscripten.py3
-rw-r--r--tools/shared.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/emscripten.py b/emscripten.py
index e90acea7..99c55174 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -172,10 +172,11 @@ def emscript(infile, settings, outfile, libraries=[]):
indexed_functions = set()
chunks = shared.JCache.chunkify(funcs, chunk_size, 'emscript_files' if jcache else None)
+
if cores == 1 and total_ll_size < MAX_CHUNK_SIZE: assert len(chunks) == 1, 'no point in splitting up without multiple cores'
if DEBUG: print >> sys.stderr, ' emscript: phase 2 working on %d chunks %s (intended chunk size: %.2f MB, meta: %.2f MB, forwarded: %.2f MB, total: %.2f MB)' % (len(chunks), ('using %d cores' % cores) if len(chunks) > 1 else '', chunk_size/(1024*1024.), len(meta)/(1024*1024.), len(forwarded_data)/(1024*1024.), total_ll_size/(1024*1024.))
- commands = [(i, [func[1] for func in chunks[i]], meta, settings_file, compiler, forwarded_file, libraries) for i in range(len(chunks))]
+ commands = [(i, chunks[i], meta, settings_file, compiler, forwarded_file, libraries) for i in range(len(chunks))]
if len(chunks) > 1:
pool = multiprocessing.Pool(processes=cores)
diff --git a/tools/shared.py b/tools/shared.py
index 95ec15b9..8cbafcfa 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -1275,7 +1275,7 @@ class JCache:
for ident, data in chunk:
new_mapping[ident] = i
cPickle.Pickler(open(chunking_file, 'wb')).dump(new_mapping)
- return chunks
+ return [''.join([func[1] for func in chunk]) for chunk in chunks] # remove function names
class JS:
@staticmethod