GNOME Bugzilla – Bug 748492
Make ring contain only onscreen contents
Last modified: 2021-06-10 15:03:23 UTC
Currently the ring contains data for 2^N-1 lines (for some N). Even if we stick to doubling and never freeing the malloced area (for which there's not much reason, since it only happens on resize which is an expensive operation anyways), I think we should only use it for the onscreen data (potentially leaving up to half of the allocated memory unused, who cares). Instead, every row that leaves the visible part should be immediately sent to the stream. This would simplify the code and make it robust against potential bugs that only occur at certain window heights. In particular, the fix to bug 748484 could become way simpler. _vte_ring_reset_streams() wouldn't need to take a "position" parameter and we wouldn't need to move forward with row_stream's head, it could stay the same. In turn, the whole concept of resetting the file stream (or boa or snake) would be gone, it'd be replaced by a special case of advance_tail (where the new tail is the same as the current head).
The idea for exponential growth is that if you start resizing, we don't have to resize / copy array at every one additional row. Other than that, your proposal looks good to me. I believe you had proposed this same thing a while back, but guess you never got to implement it.
Yup I recall having propsed it already (can't remember when & where), but never started working on this. ;)
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vte/-/issues/2201.