Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Opt-in API that has a cached `ThreadpoolController`

Đang mở
#254 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@itamarst đang làm issue này rồi.

Từ ngày 23/9/2026.

  • #257 của @itamarst — đang mở

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
performance

Hướng nghiên cứu

The proposal is a top-level get_cached_controller(force_new=False) API that caches a controller and rebuilds it when the number of loaded modules in sys.modules changes. Work is already under way in linked pull request #257, so read that PR and the three-comment thread before starting, to see what is still undecided. Done means the cache invalidates on new imports and force_new=True always rebuilds, and that behaviour is covered by tests.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Creating a controller is still expensive on Linux at least, so for libraries that do this a lot a cached version that notices when libraries change might be useful.

My thought is a top-level API get_cached_controller(force_new=False), that checks if e.g. the length of sys.modules has changed. If yes, it creates (and caches) a new controller, otherwise it returns a cached one. With force_new=True it always invalidates.

Application authors would presumably know that there's no other mechanism where new libraries might get loaded.

I would like to use this for joblib, on the theory that:

  1. Joblib never had this oversubscription mitigation before.
  2. This will catch the vast majority of cases where new libraries get added.
  3. In the rare cases it doesn't catch a loaded library, it's not a bug, it's just a performance hit... and again, joblib never solved this before anyway so those users are no worse off.
Ngôn ngữ chính
Python
Star
434
Fork
38
Merge trung bình
2 ngày 14 giờ
Pull request đã merge (30 ngày)
8

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của joblib/threadpoolctl

Tất cả issue của joblib/threadpoolctl

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.