2013-04-23 04:59:13 +04:00
|
|
|
'''
|
2013-08-16 04:45:33 +04:00
|
|
|
Simple tool to find big functions in a js or ll file
|
2013-04-23 04:59:13 +04:00
|
|
|
'''
|
|
|
|
|
|
|
|
import os, sys, re
|
|
|
|
|
|
|
|
filename = sys.argv[1]
|
|
|
|
i = 0
|
|
|
|
start = -1
|
2013-07-25 20:28:17 +04:00
|
|
|
curr = None
|
2013-07-19 05:58:27 +04:00
|
|
|
data = []
|
2013-04-23 04:59:13 +04:00
|
|
|
for line in open(filename):
|
|
|
|
i += 1
|
2014-07-25 02:44:29 +04:00
|
|
|
if line.startswith(('function ', 'define ')) and '}' not in line:
|
2013-04-23 04:59:13 +04:00
|
|
|
start = i
|
|
|
|
curr = line
|
2013-07-25 20:28:17 +04:00
|
|
|
elif line.startswith('}') and curr:
|
2013-04-23 04:59:13 +04:00
|
|
|
size = i - start
|
2013-07-25 20:28:17 +04:00
|
|
|
data.append([curr, size])
|
|
|
|
curr = None
|
2013-10-11 03:34:54 +04:00
|
|
|
data.sort(lambda x, y: x[1] - y[1])
|
2013-07-19 05:58:27 +04:00
|
|
|
print ''.join(['%6d : %s' % (x[1], x[0]) for x in data])
|
|
|
|
|