Replace ChildBufferCache with a simpler stack allocator. - #25593
Replace ChildBufferCache with a simpler stack allocator.#25593ickshonpe wants to merge 2 commits into
ChildBufferCache with a simpler stack allocator.#25593Conversation
Instead of the vec of vecs, use a single vec stack allocator.
PPakalns
left a comment
There was a problem hiding this comment.
Using cnt, pop(), sort_by_key Reverse in some special cases could use even less memory, but probably in average case is just more complex code.
LGTM.
Just an optional idea: One more optimization to avoid storing start, end on stack. This function can be implemented as one while loop which at the start stores initial node_entity in child_buffer and then uses This would reduce amount of data stored on stack during recursion. But additional profiling is needed, maybe compiler already does some optimizations. Recursive implementation of course is easier to understand than loop one. |
Objective
Replace the
ChildBufferCacheused inui_stack_systemwith a simpler stack allocator.Solution
Instead of the vec of vecs, use a single vec stack allocator.
Testing
The
stackmodule's tests all still pass.Showcase