-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Circular / Ring Buffer for Text Widget #293
Comments
Hi @timbutler, you raise a good point about the memory usage when the Adding an optional circular buffer sounds like a great idea. Such PR would be a great addition to the Don't hesitate to let me know if you have any questions or would like to discuss the API change upfront. |
Thanks for the rapid feedback @mum4k! I'll tidy my quick edits and submit a PR in the next few days for further feedback. |
Sounds great, looking forward to it @timbutler. |
See issue #293 where memory and performance can degrade with a high number of lines written to the Text widget. This is a very simplistic implementation to limit the possible length the text buffer can grow to with the `maxContent` option. Default value of -1 means there's no limit and therefore behaviour should remain standard. It has been working in our test app and allows the use of the Text widget to monitor logs (ie tail) and therefore doesn't bloat over time, but happy to adjust as required.
See issue #293 where memory and performance can degrade with a high number of lines written to the Text widget. This is a very simplistic implementation to limit the possible length the text buffer can grow to with the `maxContent` option. Default value of -1 means there's no limit and therefore behaviour should remain standard. It has been working in our test app and allows the use of the Text widget to monitor logs (ie tail) and therefore doesn't bloat over time, but happy to adjust as required.
I've started using this for a quick internal project, with one of features being log files monitored and displayed in real-time while other stats are displayed.
While this is working, one issue we've of course hit is when verbose logs are monitored that the size of the text buffer keeps increasing and of course leads to high memory usage and performance degradation.
A possible fix to this is to implement a simple ring buffer, where the Text
content
has an (optional) maximum it can grow to. During theWrite
call it could then pop content off the top of the buffer as required so that it never grows further than the maximum content.I've added this as a basic proof of concept internally, but wanted to confirm if this would be the best approach (or if I'm missing something obvious!) before submitting any pull request.
The text was updated successfully, but these errors were encountered: