We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8ad460e commit aa4b2f5Copy full SHA for aa4b2f5
tests/test_local_sampling_benchmark.py
@@ -2,15 +2,15 @@
2
import pkgutil
3
from pkg_resources import resource_filename
4
5
-from aws_xray_sdk.core.sampling.local.sampler import LocalSampler
+# 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)
10
11
+# Slower
12
def test_pkg_resources_static_read(benchmark):
13
def get_sampling_rule():
14
with open(resource_filename(__name__, 'mock_sampling_rule.json')) as f:
15
return json.load(f)
16
benchmark(get_sampling_rule)
-
-def test_pkgutil_static_read(benchmark):
- def get_sampling_rule():
- json.loads(pkgutil.get_data(__name__, 'mock_sampling_rule.json'))
- benchmark(get_sampling_rule)
0 commit comments