aboutsummaryrefslogtreecommitdiff
path: root/tools/find_bigvars.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-08-12 10:14:17 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-08-12 10:14:17 -0700
commit846fb98f0ac29dc556c80b606ce7e6e9c1c8afae (patch)
treeb4b230bc535657f02188b88dffd3aa13f517860f /tools/find_bigvars.py
parent8cb83003709aa90a3410b6352552342ec97d5116 (diff)
tool to find functions with lots of vars
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])
+