-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
exercises.py
47 lines (29 loc) · 949 Bytes
/
exercises.py
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
41
42
43
44
45
46
47
from pytest_perf.deco import extras
@extras('perf')
def discovery_perf():
"discovery"
import importlib_metadata # end warmup
importlib_metadata.distribution('ipython')
def entry_points_perf():
"entry_points()"
import importlib_metadata # end warmup
importlib_metadata.entry_points()
@extras('perf')
def cached_distribution_perf():
"cached distribution"
import importlib_metadata
importlib_metadata.distribution('ipython') # end warmup
importlib_metadata.distribution('ipython')
@extras('perf')
def uncached_distribution_perf():
"uncached distribution"
import importlib
import importlib_metadata
# end warmup
importlib.invalidate_caches()
importlib_metadata.distribution('ipython')
def entrypoint_regexp_perf():
import re
import importlib_metadata
input = '0' + ' ' * 2**10 + '0' # end warmup
re.match(importlib_metadata.EntryPoint.pattern, input)