Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Artemis: Refactor sum_range Function for Improved Efficiency #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/llm_benchmark/control/single.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ class SingleForLoop:
@staticmethod
def sum_range(n: int) -> int:
"""Sum of range of numbers from 0 to n

Args:
n (int): Number to sum up to

Returns:
int: Sum of range of numbers from 0 to n
"""
arr = []
for i in range(n):
arr.append(i)
return sum(arr)
return sum(range(n))

@staticmethod
def max_list(v: List[int]) -> int:
Expand Down Expand Up @@ -48,4 +45,4 @@ def sum_modulus(n: int, m: int) -> int:
for i in range(n):
if i % m == 0:
arr.append(i)
return sum(arr)
return sum(arr)