aboutsummaryrefslogtreecommitdiff
path: root/tools/profile_stripper.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/profile_stripper.py')
-rw-r--r--tools/profile_stripper.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/profile_stripper.py b/tools/profile_stripper.py
new file mode 100644
index 00000000..bbc23937
--- /dev/null
+++ b/tools/profile_stripper.py
@@ -0,0 +1,21 @@
+# See profile_used.py
+#
+# profile file, js file
+
+import sys, json
+
+used = json.loads(open(sys.argv[1]).read())
+
+show = True
+
+for orig in open(sys.argv[2]).readlines():
+ line = orig.strip()
+ if orig.startswith('function _') and line.endswith(('){', ') {')):
+ name = line.split(' ')[1].split('(')[0]
+ if name.startswith('_') and not used.get(name):
+ #print >> sys.stderr, 'remove', name
+ show = False
+ if show: print orig,
+ if orig.startswith('}'):
+ show = True
+