Skip to content

gh-145230: Update lockbench#145231

Open
colesbury wants to merge 3 commits intopython:mainfrom
colesbury:gh-145230-lockbench-update
Open

gh-145230: Update lockbench#145231
colesbury wants to merge 3 commits intopython:mainfrom
colesbury:gh-145230-lockbench-update

Conversation

@colesbury
Copy link
Contributor

@colesbury colesbury commented Feb 25, 2026

Remove PyThread_type_lock (now uses PyMutex internally).

Add new benchmark options:

  • work_inside/work_outside: control work inside and outside the critical section to vary contention levels
  • num_locks: use multiple independent locks with threads assigned round-robin
  • total_iters: fixed iteration count per thread instead of time-based, useful for measuring fairness
  • num_acquisitions: lock acquisitions per loop iteration
  • random_locks: acquire random lock each iteration

Also return elapsed time from benchmark_locks() and switch lockbench.py to use argparse.

Remove PyThread_type_lock (now uses PyMutex internally).

Add new benchmark options:
- work_inside/work_outside: control work inside and outside the
  critical section to vary contention levels
- num_locks: use multiple independent locks with threads assigned
  round-robin
- total_iters: fixed iteration count per thread instead of time-based,
  useful for measuring fairness
- num_acquisitions: lock acquisitions per loop iteration

Also return elapsed time from benchmark_locks() and switch lockbench.py
to use argparse.
@colesbury colesbury marked this pull request as ready for review February 27, 2026 15:44
@colesbury colesbury requested a review from mpage February 27, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants