Skip to content

Commit

Permalink
add default arguments for run count methods
Browse files Browse the repository at this point in the history
  • Loading branch information
aktech authored Jul 18, 2024
1 parent 38a3367 commit a9e1f0f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
run: |
python python_c_extension/c_extension_gil.py
env:
PYTHONPATH: "."
PYTHON_GIL: 0

- name: Run Tests
Expand Down
4 changes: 2 additions & 2 deletions python_c_extension/c_extension_gil.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ def count_pure_python(n):
n -= 1


def run_count_in_single_thread(count_func):
def run_count_in_single_thread(count_func=count):
t1 = time()
count_func(N)
time_taken = time() - t1
return time_taken


def run_count_in_multiple_threads(count_func):
def run_count_in_multiple_threads(count_func=count):
t1 = time()
th1 = Thread(target=count_func, args=(N // 2,))
th2 = Thread(target=count_func, args=(N // 2,))
Expand Down

0 comments on commit a9e1f0f

Please sign in to comment.