Attribute cache silently disabled after 1000 class edit, leading to poor performance
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
Bug report
Bug description:
After the changes from https://github.com/python/cpython/pull/114900 modifying a class more than 1000 times causes the attribute cache to be permanently disabled for that class. This was done to solve a crash when a class is modified more than 2**32 times ( https://github.com/python/cpython/issues/113462 )
It seems this number (1000) is too low for some real case applications.
I initially observed this as a ~50% performance regression in ERP5 performance tests when updating from python3.11 to python3.13. ERP5 is an application where classes are generated dynamically based on some configuration and some classes are modified more than 1000 times in the "normal" generation process.
This seems to also affect odoo, another ERP application, for this they resorted to using ctypes to reset the class version attribute ( https://github.com/odoo/odoo/pull/275640 )
My suggestion would be to use a much higher number before disabling the cache, 1000 is low.
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách xem xét pull request 114900 của CPython và issue 113462, sau đó theo dõi cách bộ nhớ đệm thuộc tính bị vô hiệu hóa sau khi các lớp bị sửa đổi nhiều lần. Sử dụng các trường hợp ERP5 và Odoo được mô tả trong issue làm các kịch bản hiệu năng. Được xem là hoàn thành khi tránh được hồi quy đã nêu mà vẫn xử lý kịch bản crash từ issue 113462.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- performance
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100