-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a99e52a
commit bcb75b4
Showing
4 changed files
with
34 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,37 @@ | ||
"""Two sample benchmarks to compute runtime and memory usage. | ||
import benchmarking_asv as bench | ||
|
||
For more information on writing benchmarks: | ||
https://asv.readthedocs.io/en/stable/writing_benchmarks.html.""" | ||
|
||
import example_benchmarks | ||
class TimeSuite: # pylint: disable=too-few-public-methods | ||
"""An example benchmark that times the performance of various kinds | ||
of iterating over dictionaries in Python.""" | ||
|
||
def __init__(self): | ||
self.d = {} | ||
|
||
def time_computation(): | ||
"""Time computations are prefixed with 'time'.""" | ||
example_benchmarks.runtime_computation() | ||
def setup(self): | ||
self.d = {} | ||
for x in range(500): | ||
self.d[x] = None | ||
|
||
def time_keys(self): | ||
"""Time first method.""" | ||
bench.example_module.run_time_computation() | ||
|
||
def mem_list(): | ||
"""Memory computations are prefixed with 'mem' or 'peakmem'.""" | ||
return example_benchmarks.memory_computation() | ||
def time_iterkeys(self): | ||
"""Time second method.""" | ||
bench.example_module.run_time_computation() | ||
|
||
def time_range(self): | ||
"""Time third method.""" | ||
bench.example_module.run_time_computation() | ||
|
||
def time_xrange(self): | ||
"""Time fourth method.""" | ||
bench.example_module.run_time_computation() | ||
|
||
|
||
class MemSuite: # pylint: disable=too-few-public-methods | ||
"""An example benchmark that times memory consumption.""" | ||
|
||
def mem_list(self): | ||
return bench.example_module.run_mem_computation() |
This file was deleted.
Oops, something went wrong.
Empty file.
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
"""An example module containing testing of mock functions.""" | ||
|
||
import benchmarking_asv | ||
from benchmarking_asv import example_module | ||
|
||
|
||
def test_greetings() -> None: | ||
"""Verify the output of the `greetings` function""" | ||
output = benchmarking_asv.example_module.greetings() | ||
output = example_module.greetings() | ||
assert output == "Hello from LINCC-Frameworks!" | ||
|
||
|
||
def test_meaning() -> None: | ||
"""Verify the output of the `meaning` function""" | ||
output = benchmarking_asv.example_module.meaning() | ||
output = example_module.meaning() | ||
assert output == 42 |