Skip to content

PERF Run faster on Linux - #250

Merged
ogrisel merged 34 commits into
joblib:masterfrom
itamarst:248-faster-linux
Sep 18, 2026
Merged

ogrisel merged 34 commits into
joblib:masterfrom
itamarst:248-faster-linux

Conversation

@itamarst

@itamarst itamarst commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #248

Benchmarked with python benchmarks/bench_context_manager_overhead.py --n-calls 10_000 --import numpy on 3.14 free-threaded.

  • 3.7.0: 0.223 +/-0.256 ms
  • This PR: 0.127 +/-0.251 ms

Switch to dllist() is even faster, but not a good idea before Python 3.15.

@itamarst
itamarst marked this pull request as ready for review September 16, 2026 16:15

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. LGTM but I think we could improve the testing harness as follows:

Comment thread tests/test_threadpoolctl.py Outdated
Comment thread tests/test_threadpoolctl.py Outdated
Comment thread tests/test_threadpoolctl.py Outdated
Comment thread threadpoolctl.py Outdated
# enabling it on GIL Python too once threadpoolctl supports 3.15.
and not (
sys.version_info[:2] >= (3, 15)
and not getattr(sys, "_is_gil_enabled", lambda: True)()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a linux free-threading CPython 3.15 config to the CI to exercise this condition.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried, but it's a real pain to get things going with release candidates. I suggest waiting until it's no longer pre-release and doing it in #251.

@itamarst

Copy link
Copy Markdown
Contributor Author

Thank you, I'll address these today hopefully.

itamarst and others added 2 commits September 17, 2026 11:48
Comment thread threadpoolctl.py Outdated
@itamarst

Copy link
Copy Markdown
Contributor Author

I'm getting close to just giving up on 3.15 environments for now; either one would switch to installing Python via GitHub Actions, or just wait a month or three until conda-forge is caught up.

@itamarst

Copy link
Copy Markdown
Contributor Author

Yeah I'm giving up on this for now. Will revert those changes.

@itamarst
itamarst requested a review from ogrisel September 17, 2026 17:25
@ogrisel

ogrisel commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Did you run the tests locally on free-threading Python 3.15?

EDIT: I just did and everything looks good.

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Will merge and follow-up with a dedicated PR to add 3.15 CI config and official support in the metadata.

@ogrisel
ogrisel merged commit b0e4a50 into joblib:master Sep 18, 2026
24 checks passed
cursor Bot pushed a commit to ogrisel/threadpoolctl that referenced this pull request Sep 18, 2026
joblib#250 already marks the OpenMP test helpers as free-threading
compatible in the pyx files, so restore the setup scripts to the
plain compiler_directives dicts. Use FREETHREADING=1 for the RC
free-threaded jobs to match the existing 3.14 CI flag.

Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
@itamarst
itamarst deleted the 248-faster-linux branch September 18, 2026 13:19
@itamarst

Copy link
Copy Markdown
Contributor Author

Thank you!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The new Linux /proc/self/maps shared library listing is very slow

2 participants