aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-01-13 13:26:51 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-01-13 13:26:51 -0800
commitd9c105af0351ead96e37899d14ad074a1fb1d137 (patch)
tree2e518612c51d13543eeb36abee1cb0cd21ce8ccb
parentb97c1bc76ca7fa519ecb294e96c763e2e089653c (diff)
optimize searching in set of implemented functions in fastcomp toolchain code
-rwxr-xr-xemscripten.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/emscripten.py b/emscripten.py
index 8ddb7375..befad8d5 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -872,6 +872,7 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
for key in metadata['implementedFunctions'] + forwarded_json['Functions']['implementedFunctions'].keys(): # XXX perf
if key in all_exported_functions or export_all or (export_bindings and key.startswith('_emscripten_bind')):
exported_implemented_functions.add(key)
+ implemented_functions = set(metadata['implementedFunctions'])
# Add named globals
named_globals = '\n'.join(['var %s = %s;' % (k, v) for k, v in metadata['namedGlobals'].iteritems()])
@@ -925,7 +926,7 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
Counter.j += 1
newline = Counter.j % 30 == 29
if item == '0': return bad if not newline else (bad + '\n')
- if item not in metadata['implementedFunctions']:
+ if item not in implemented_functions:
# this is imported into asm, we must wrap it
call_ident = item
if call_ident in metadata['redirects']: call_ident = metadata['redirects'][call_ident]
@@ -1025,7 +1026,7 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
pass
# If no named globals, only need externals
global_vars = metadata['externs'] #+ forwarded_json['Variables']['globals']
- global_funcs = list(set(['_' + key for key, value in forwarded_json['Functions']['libraryFunctions'].iteritems() if value != 2]).difference(set(global_vars)).difference(set(metadata['implementedFunctions'])))
+ global_funcs = list(set(['_' + key for key, value in forwarded_json['Functions']['libraryFunctions'].iteritems() if value != 2]).difference(set(global_vars)).difference(implemented_functions))
def math_fix(g):
return g if not g.startswith('Math_') else g.split('_')[1]
asm_global_funcs = ''.join([' var ' + g.replace('.', '_') + '=global.' + g + ';\n' for g in maths]) + \