alexmojaki / alexmojaki/executing

parent pointers in AST nodes hurt deepcopy performance

Đang mở
#63 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
401
Fork
38
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Obligatory "I'm a huge fan of your work".

Background: I maintain a library called [ipyflow](https://github.com/ipyflow/ipyflow), which uses another library I maintain called [pyccolo](https://github.com/smacke/pyccolo). I noticed that on ipython >= 8.0, which uses `executing` for better stack traces, ipyflow would have really bad performance regressions the first time after a cell throws some exception.

Eventually I traced it to pyccolo's use of `copy.deepcopy` in a few places -- performance was bad because the parent pointers that `executing` added to AST nodes were causing deepcopy to do a lot of extra unnecessary work.

I ended up working around it on the pyccolo side, but I figured you may be interested in this for other libraries that may want to use `executing` and get surprised when `deepcopy` has bad perf. The way we maintain deepcopy-ability in pyccolo is to maintain a mapping from id(node) to parent for parent pointers, which avoids setting an attribute on the AST node directly.

Thanks for this great library!

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

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.