GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Update lockbench.py · Issue #145230 · python/cpython

Update lockbench.py #145230

New issue
Copy link
New issue
Copy link
Closed
Closed
Update lockbench.py#145230
Copy link
Labels
topic-free-threadingtriagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.type-featureA feature request or enhancementA feature request or enhancement

Description

@colesbury
colesbury
opened on Feb 25, 2026
Issue body actions

Feature or enhancement

The lockbench.py benchmarks PyMutex and PyThread_type_lock for various number of threads and length of critical section. You'll see similar benchmarks for other mutex implementations: Rust parking_lot, WebKit.

I'd like to make a few updates to this benchmark:

  • Remove PyThread_type_lock. It's now based on PyMutex, so this isn't really useful anymore.
  • Add --work-outside to adjust the amount work done while not holding the lock. This helps simulate low and moderate contention scenarios.
  • Add --num-locks. So if we run with 8 threads and 2 locks, each group of 4 threads is independently contending for a lock. This adds more concurrency and helps demonstrate the limits of excessive spinning.
  • Make number of threads configurable
  • Add --total-iters which configures each thread to run for a fixed number of iterations instead of the default of running the whole benchmark for 1 second. With this mode, the benchmarks is only as fast as the slowest thread. It's another way to measure the effect of "fairness".

Linked PRs

  • gh-145230: Update lockbench #145231
  • gh-145230: Update lockbench.py and benchmark_locks API #145271

Activity

  1. colesbury
    added
    type-featureA feature request or enhancementA feature request or enhancement
    topic-free-threading
    on Feb 25, 2026
  2. colesbury
    added a commit that references this issue on Feb 25, 2026

    pythongh-145230: Update lockbench

    f4671b5
  3. StanFromIreland
    added
    triagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.
    on Feb 25, 2026
  4. gourijain029-del
    added a commit that references this issue on Feb 26, 2026

    pythongh-145230: Update lockbench.py and benchmark_locks API

    aa29467
  5. colesbury
    added a commit that references this issue on Feb 27, 2026

    gh-145230: Update lockbench (gh-145231)

    72eca2a
  6. colesbury
    closed this as completedon Feb 27, 2026
  7. brijkapadia
    added a commit that references this issue on Feb 28, 2026

    pythongh-145230: Update lockbench (pythongh-145231)

    07be84d
  8. ljfp
    added a commit that references this issue on Apr 25, 2026

    pythongh-145230: Update lockbench (pythongh-145231)

    c240b6f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-free-threadingtriagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.type-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.