aboutsummaryrefslogtreecommitdiff
path: root/tools/find_bigvars.py
diff options
context:
space:
mode:
authorToadKing <toadking@toadking.com>2013-08-12 23:30:49 -0400
committerToadKing <toadking@toadking.com>2013-08-12 23:30:49 -0400
commit7466223864929d50d02407dde1da331133a0bef1 (patch)
tree60403b8061880e6aea503a20d9c45b3e678ec6ad /tools/find_bigvars.py
parentc2b064eb49ea63eec59add5751c8a9c2b80dab92 (diff)
parent3090cdd713609a9d3f749d13002a898e03cbd5e3 (diff)
Merge branch 'incoming' of https://github.com/kripken/emscripten into fixed_openal_buffers
Conflicts: src/library_openal.js
Diffstat (limited to 'tools/find_bigvars.py')
-rw-r--r--tools/find_bigvars.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/find_bigvars.py b/tools/find_bigvars.py
new file mode 100644
index 00000000..6bee5dd4
--- /dev/null
+++ b/tools/find_bigvars.py
@@ -0,0 +1,24 @@
+'''
+Simple tool to find functions with lots of vars.
+'''
+
+import os, sys, re
+
+filename = sys.argv[1]
+i = 0
+curr = None
+data = []
+size = 0
+for line in open(filename):
+ i += 1
+ if line.startswith('function '):
+ size = len(line.split(',')) # params
+ curr = line
+ elif line.strip().startswith('var '):
+ size += len(line.split(',')) + 1 # vars
+ elif line.startswith('}') and curr:
+ data.append([curr, size])
+ curr = None
+data.sort(lambda x, y: x[1] - y[1])
+print ''.join(['%6d : %s' % (x[1], x[0]) for x in data])
+