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 22import pkgutil
33from pkg_resources import resource_filename
44
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 )
610
11+ # Slower
712def test_pkg_resources_static_read (benchmark ):
813 def get_sampling_rule ():
914 with open (resource_filename (__name__ , 'mock_sampling_rule.json' )) as f :
1015 return json .load (f )
1116 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