Calls across stack chunks perform badly
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ả
The Python stack is composed of a series of chunks of memory. These chunks are large, so we cross the boundaries infrequently and assume that it will never be on the fast path.
Unfortunately, it is possible to cross the boundary repeatedly if looping deep in the stack.
We should adjust the stack when crossing the boundary, to avoid doing so repeatedly.
Possible options include:
- Move the caller to the new chunk, so repeated calls do not cross the boundary.
- Instead of using a chunked stack, double the size of the stack and copy the old stack.
Both of these assume that we can move the frame. This is only possible if there are no pointers into the frame.
If a frames calls a native function taking an array of arguments, then there will be pointers into the frame.
So if we do any moving, we need to check for these pointers.
While we cannot move the frame, we can copy it, as long as the original remains. This is a bit wasteful, but shouldn't happen too often or waste too much space.
Linked PRs
- gh-145789
- gh-145828
- gh-145829
- gh-146123
- gh-148681
- gh-149097
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 việc xem xét các PR được liên kết gh-145789, gh-145828, gh-145829, gh-146123, gh-148681 và gh-149097, vì issue không cung cấp tệp hoặc test nào. Hoàn thành có nghĩa là tránh các lần chuyển qua lại lặp lại giữa các chunk của stack mà vẫn bảo toàn tính đúng đắn khi các lời gọi native giữ các con trỏ vào các frame.
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ó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100