Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Hunter <[email protected]>
  • Loading branch information
ianfhunter authored Nov 17, 2023
1 parent bbb6b11 commit 473b826
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions scripts/benchmark/benchmark_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ def __init__(self, start_range=0, end_range=10):
self.range = range(start_range, end_range)
self.plt = plt

def add_function(self,
name,
f,
color="r",
marker="o",
hard_limit=None,
override=None):
def add_function(
self,
name,
f,
color="r",
marker="o",
hard_limit=None,
override=None
):
"""Adds a function to the list of functions to benchmark.
@name - Human Readable name
@f - function
Expand Down Expand Up @@ -81,9 +83,11 @@ def benchmark(self, title):
# ------ BENCHMARK ------
time1 = time.time()
try:
func_timeout.func_timeout(self.TIMEOUT_SECONDS,
roll_fn,
args=[r])
func_timeout.func_timeout(
self.TIMEOUT_SECONDS,
roll_fn,
args=[r]
)
except (Exception, func_timeout.FunctionTimedOut) as e:
print(f"Err: {c['name']}:{r}")
print("\t", e)
Expand All @@ -102,10 +106,12 @@ def benchmark(self, title):
y.append(tt * 1000)

if y:
plt.plot(shared_x[0:len(y)],
y,
color=c["color"],
marker=c["marker"])
plt.plot(
shared_x[0:len(y)],
y,
color=c["color"],
marker=c["marker"]
)
print("Result:", y)

# Configuration and Output
Expand Down

0 comments on commit 473b826

Please sign in to comment.