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: Proposed changes for increased performance #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
9 changes: 3 additions & 6 deletions src/llm_benchmark/algorithms/sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ class Sort:
@staticmethod
def sort_list(v: List[int]) -> None:
"""Sort a list of integers in place

Args:
v (List[int]): List of integers
"""
for i in range(len(v)):
for j in range(i + 1, len(v)):
if v[i] > v[j]:
v[i], v[j] = v[j], v[i]
v.sort()

@staticmethod
def dutch_flag_partition(v: List[int], pivot_value: int) -> None:
Expand Down Expand Up @@ -56,4 +53,4 @@ def max_n(v: List[int], n: int) -> List[int]:
max_idx = j
ret[i] = max_val
tmp.pop(max_idx)
return ret
return ret
12 changes: 4 additions & 8 deletions src/llm_benchmark/control/single.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,14 @@ def sum_range(n: int) -> int:
@staticmethod
def max_list(v: List[int]) -> int:
"""Maximum value in a vector

Args:
v (List[int]): Vector of integers

Returns:
int: Maximum value in the vector
"""
max_val = v[0]
for i in range(1, len(v)):
if v[i] > max_val:
max_val = v[i]
return max_val
return max(v)

@staticmethod
def sum_modulus(n: int, m: int) -> int:
Expand All @@ -48,4 +44,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)