File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 2
2
import pkgutil
3
3
from pkg_resources import resource_filename
4
4
5
- from aws_xray_sdk .core .sampling .local .sampler import LocalSampler
5
+ # Faster
6
+ def test_pkgutil_static_read (benchmark ):
7
+ def get_sampling_rule ():
8
+ return json .loads (pkgutil .get_data (__name__ , 'mock_sampling_rule.json' ))
9
+ benchmark (get_sampling_rule )
6
10
11
+ # Slower
7
12
def test_pkg_resources_static_read (benchmark ):
8
13
def get_sampling_rule ():
9
14
with open (resource_filename (__name__ , 'mock_sampling_rule.json' )) as f :
10
15
return json .load (f )
11
16
benchmark (get_sampling_rule )
12
-
13
- def test_pkgutil_static_read (benchmark ):
14
- def get_sampling_rule ():
15
- json .loads (pkgutil .get_data (__name__ , 'mock_sampling_rule.json' ))
16
- benchmark (get_sampling_rule )
You can’t perform that action at this time.
0 commit comments