Skip to content

PERF Go faster by caching library detection and loading - #249

Open
itamarst wants to merge 15 commits into
joblib:masterfrom
itamarst:246-go-faster
Open

itamarst wants to merge 15 commits into
joblib:masterfrom
itamarst:246-go-faster

Conversation

@itamarst

@itamarst itamarst commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #246

See benchmarks below

Comment thread threadpoolctl.py Outdated
@itamarst

Copy link
Copy Markdown
Contributor Author

Will re-open when it's ready for review.

@itamarst itamarst closed this Sep 18, 2026
@itamarst itamarst reopened this Sep 21, 2026
@itamarst

Copy link
Copy Markdown
Contributor Author

Benchmarks, python benchmarks/bench_context_manager_overhead.py --n-calls 50_000 --import numpy with 3.14t.

  • Master branch: 0.125 +/-0.291 ms
  • This PR: 0.0705 +/-0.0688 ms.

@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.

I confirm I also oberseve a factor of 2+ reduction in the threadpool_limits call (with the sklearn module imported) on my macOS host: from 0.5 ms per call on master vs 0.2 ms per call on this branch.

Comment thread tests/test_cache.py Outdated
Comment thread threadpoolctl.py
@itamarst itamarst changed the title PERF Go faster by caching library detection and loading (WIP) PERF Go faster by caching library detection and loading Sep 21, 2026
@itamarst
itamarst marked this pull request as ready for review September 21, 2026 15:14
@itamarst
itamarst requested a review from ogrisel September 21, 2026 16:19
@itamarst
itamarst marked this pull request as draft September 21, 2026 16:20
@itamarst
itamarst marked this pull request as ready for review September 21, 2026 16:20
@itamarst
itamarst marked this pull request as draft September 21, 2026 16:20
@itamarst
itamarst marked this pull request as ready for review September 21, 2026 16:54
@itamarst

Copy link
Copy Markdown
Contributor Author

OK should be ready for review again.

@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!

Let's wait a bit for @jeremiedbb to give his own feedback.

This branch has not been deployed

No deployments
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.

Speed up usage of threadpoolctl

2 participants