forked from beautifier/js-beautify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs-beautify-profile
executable file
·34 lines (27 loc) · 954 Bytes
/
js-beautify-profile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /usr/bin/env python
# To run this: ./js-beautify/tools/python-dev python ./python/js-beautify-profile
import sys
import unittest
import pstats
from pstats import SortKey
# Speedup things...
try:
import cProfile as profile
except ImportError:
import profile
import os
import copy
import jsbeautifier
options = jsbeautifier.default_options()
options.wrap_line_length = 80
def beautifier_test_github_min():
jsbeautifier.beautify(github_min, options)
if __name__ == '__main__':
dirname = os.path.dirname(os.path.abspath(__file__))
github_min_file = os.path.join(
dirname, "../", "test/resources/github-min.js")
github_min = copy.copy(''.join(open( github_min_file).readlines()))
profile.run('beautifier_test_github_min()',
os.path.join(dirname, "../", 'build/jsbstats'))
p = pstats.Stats(os.path.join(dirname, "../", 'build/jsbstats'))
p.strip_dirs().sort_stats(SortKey.CUMULATIVE).print_stats()