anytree icon indicating copy to clipboard operation
anytree copied to clipboard

Performance issues from slow assertion

Open andrew-vant opened this issue 2 years ago • 0 comments

A few days ago I had an issue where anytree operations significantly slowed down over time. cProfile attributed the added time to this assertion. If I'm reading it correctly, it makes adding a child node take O(N) time, where N is the number of its siblings-to-be.

That N gets rather large in my case. Probably I should refactor my code to avoid that, but I felt I should report it anyway. Setting PYTHONOPTIMIZE=TRUE (to disable assertions) does work as a workaround.

andrew-vant avatar Oct 20 '22 22:10 andrew-vant