-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathbenchmark.py
More file actions
40 lines (26 loc) · 759 Bytes
/
Copy pathbenchmark.py
File metadata and controls
40 lines (26 loc) · 759 Bytes
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
35
36
37
38
39
40
import cProfile
from pstats import Stats
from curlylint.tests.utils import BlackRunner
from curlylint.cli import main
from memory_profiler import profile
runner = BlackRunner()
pr = cProfile.Profile()
pr.enable()
result = runner.invoke(main, ["--verbose", "tests/django/wagtailadmin/"])
pr.disable()
p = Stats(pr)
p.strip_dirs().sort_stats("cumulative").print_stats(10)
print(result.exit_code)
print(runner.stdout_bytes.decode())
print(runner.stderr_bytes.decode())
print("Measuring memory consumption")
@profile(precision=6)
def memory_consumption_run():
runner.invoke(
main,
[
"--verbose",
"tests/django/wagtailadmin/pages/listing/_page_title_choose.html",
],
)
memory_consumption_run()