-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #306 from NathanielRN/remove-slow-filepath-resolve
- Loading branch information
Showing
5 changed files
with
30 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"version": 2, | ||
"default": { | ||
"fixed_target": 1, | ||
"rate": 0.05 | ||
}, | ||
"rules": [ | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import json | ||
import pkgutil | ||
from pkg_resources import resource_filename | ||
|
||
# Faster | ||
def test_pkgutil_static_read(benchmark): | ||
def get_sampling_rule(): | ||
return json.loads(pkgutil.get_data(__name__, 'mock_sampling_rule.json')) | ||
benchmark(get_sampling_rule) | ||
|
||
# Slower | ||
def test_pkg_resources_static_read(benchmark): | ||
def get_sampling_rule(): | ||
with open(resource_filename(__name__, 'mock_sampling_rule.json')) as f: | ||
return json.load(f) | ||
benchmark(get_sampling_rule) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters