Skip to content

Threading brings no performance improvement + no cp314t wheel support #305

@yannsadowski

Description

@yannsadowski

Environment of launching

  • pymunk version: v7.2.0
  • Python version: 3.14t
  • OS: Ubuntu 24 (WSL2)
  • CPU: Intel(R) Core(TM) Ultra 7 255U

Issue 1 — Threading shows no improvement (or regression)

Running the official threaded_space.py example with varying thread counts and higher pyramide yields no speedup:

Threads 0, time 7.10s
Threads 1, time 7.26s
Threads 2, time 7.11s
Threads 4, time 7.26s
Threads 8, time 7.58s

With 8 threads, performance is actually worse than single-threaded. This appears to be due to synchronization overhead exceeding the parallelism gain at this simulation scale (1275 bodies, pyramid of 50 rows).

Is there a recommended minimum simulation size where threading becomes beneficial? Should the example be updated with a note about this?

Issue 2 — No wheel available for Python 3.14 free-threaded (cp314t)

Attempting to install pymunk on a Python 3.14 free-threaded build (cp314t) fails — no compatible wheel is available on PyPI, and building from source raises the following error:

RuntimeError: Unable to run "sdl-config". Please make sure a development version of SDL is installed.

Is there a plan to support the free-threaded Python 3.14 build (cp314t)? This would be particularly relevant given that free-threaded Python removes the GIL, which could make pymunk's threaded mode actually beneficial.

Question

Would free-threaded Python (cp314t) allow Chipmunk's threaded solver to run without GIL contention, and would that finally yield real multi-core speedups for the physics simulation?

Thanks for the great library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions